結果

問題 No.2502 Optimization in the Dark
ユーザー ochiaigawa
提出日時 2023-10-13 22:57:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 1,099 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 196,268 KB
最終ジャッジ日時 2025-02-17 07:28:44
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int N;
void solve(int la, int lb, int pa, int pb) {
  cout << "!";
  for(int i = 0; i < N; i++) {
    cout << ' ' << pb << ' ' << 6 - pa - pb;
  }
  for(int i = 0; i < N; i++) {
    cout << ' ' << pa << ' ' << 6 - pa - pb;
  }
  for(int i = 0; i < N; i++) {
    cout << ' ' << la << ' ' << lb;
  }
  cout << endl;
  return;
}
void ask(int x, int y) {
  cout << "? " << x << " " << N << " " << y << " " << N << endl;
  string c;
  cin >> c;
  if(c == "Yes") {
    solve(x, y, x, y);
  } else {
    solve(x, y, y, x);
  }
  return;
}
int main() {
  cin.tie(0); cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  cout << "? 1 " << 2 * N << " 2 " << 2 * N << endl;
  string a;
  cin >> a;
  if(a == "Yes") {
    cout << "? 2 " << 2 * N << " 3 " << 2 * N << endl;
    string b;
    cin >> b;
    if(b == "Yes") {
      ask(1, 2);
    } else {
      ask(1, 3);
    }
  } else {
    cout << "? 1 " << 2 * N << " 3 " << 2 * N << endl;
    string b;
    cin >> b;
    if(b == "Yes") {
      ask(1, 2);
    } else {
      ask(2, 3);
    }
  }
  return 0;
}
0