結果
問題 |
No.3120 Lower Nim
|
ユーザー |
|
提出日時 | 2025-04-19 17:19:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,662 bytes |
コンパイル時間 | 2,514 ms |
コンパイル使用メモリ | 196,816 KB |
実行使用メモリ | 26,356 KB |
平均クエリ数 | 2.00 |
最終ジャッジ日時 | 2025-04-19 17:19:51 |
合計ジャッジ時間 | 13,002 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | AC * 1 RE * 42 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } int x = 0; for(auto i : a){ x ^= i; } if(x != 0){ cout << "First" << endl; while(true){ int sel = -1; for(int i = 0; i < n; i++){ if((a[i] ^ x) <= a[i]){ sel = i; break; } } assert(sel != -1); cout << sel + 1 << " " << a[sel] - (a[sel] ^ x) << endl; a[sel] = (a[sel] ^ x); std::cout << std::endl; x = 0; for(auto v : a) x ^= v; assert (x == 0); cin >> sel >> x; a[sel - 1] -= x; int ret; cin >> ret; if(ret != 0){ return 0; } } } else{ cout << "Second" << endl; while(true){ int sel, x; cin >> sel >> x; a[sel - 1] -= x; int ret; cin >> ret; if(ret != 0){ return 0; } x = 0; for(auto i : a){ x ^= i; } sel = -1; int val = 0; for(int i = 0; i < n; i++){ if((a[i] ^ x) < a[i]){ sel = i; val = a[i] - (a[i] ^ x); a[i] ^= x; break; } } assert(sel != -1); cout << sel + 1 << " " << val << endl; } } }