結果
問題 |
No.2165 Let's Play Nim!
|
ユーザー |
👑 |
提出日時 | 2022-12-20 19:46:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 778 bytes |
コンパイル時間 | 730 ms |
コンパイル使用メモリ | 73,348 KB |
最終ジャッジ日時 | 2025-02-09 17:25:34 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 20 TLE * 17 |
ソースコード
#include <iostream> #include <vector> using namespace std; int main(){ int n;cin>>n; vector<int> A(n); int nw = 0; for(int i = 0; n > i; i++){ cin>>A[i]; nw ^= A[i]; } if(nw != 0){ cout << 1 << endl; for(int i = 0; n > i; i++){ if(A[i] >= nw){ cout << i+1 << " " << nw << endl; A[i] -= nw; break; } } int ret;cin>>ret; if(ret == -1)return 0; }else{ cout << 0 << endl; } while(true){ int i,k;cin>>i>>k; A[i-1] -= k; int ret;cin>>ret; if(ret == -1)return 0; for(int j = 0; n > j; j++){ if(A[j] >= nw && (A[j]^(A[j]-k)) == k){ cout << j+1 << " " << k << endl; A[j] -= nw; break; } } cin>>ret; if(ret == -1)return 0; } }