結果
問題 | No.2502 Optimization in the Dark |
ユーザー |
![]() |
提出日時 | 2024-06-20 14:05:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,375 bytes |
コンパイル時間 | 381 ms |
コンパイル使用メモリ | 41,216 KB |
最終ジャッジ日時 | 2025-02-21 23:30:44 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 WA * 18 |
コンパイルメッセージ
main.cpp: In function ‘bool query(int, int, int, int)’: main.cpp:18:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%s", s); | ~~~~~^~~~~~~~~ main.cpp: In function ‘int main()’: main.cpp:47:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 47 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 2502.cc: No.2502 Optimization in the Dark - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* subroutines */ bool query(int i, int x, int j, int y) { printf("? %d %d %d %d\n", i + 1, x + 1, j + 1, y + 1); fflush(stdout); char s[8]; scanf("%s", s); return (s[0] == 'Y'); } void op1(int p0, int p1, int p2) { // 2 x 3 // 0 0 1 // 1 2 2 printf(" %d %d", p0 + 1, p1 + 1); printf(" %d %d", p2 + 1, p0 + 1); printf(" %d %d", p1 + 1, p2 + 1); } void op2(int p0, int p1, int p2) { // 4 x 3 // 0 0 1 // 1 2 3 // 2 4 4 // 3 5 5 printf(" %d %d", p0 + 1, p1 + 1); printf(" %d %d", p2 + 1, p0 + 1); printf(" %d %d", p1 + 1, p0 + 1); printf(" %d %d", p0 + 1, p2 + 1); printf(" %d %d", p1 + 1, p2 + 1); printf(" %d %d", p1 + 1, p2 + 1); } /* main */ int main() { int n; scanf("%d", &n); int n2 = n * 2; bool f0 = query(0, n2 - 1, 1, n2 - 1); int p0 = f0 ? 1 : 0; bool f1 = query(p0, n2 - 1, 2, n2 - 1); if (f1) p0 = 2; int p1 = (p0 + 1) % 3, p2 = (p0 + 2) % 3; bool f2 = query(p1, n2 - 2, p2, n2 - 2); if (f2) swap(p1, p2); // v[p0][n2] >= max(v[p1][n2], v[p2][n2] // v[p1][n2-1] >= v[p2][n2-1] int k = 0; putchar('!'); if (n & 1) op1(p0, p1, p2), k++; while (k < n) op2(p0, p1, p2), k += 2; putchar('\n'); fflush(stdout); return 0; }