結果
問題 |
No.3120 Lower Nim
|
ユーザー |
|
提出日時 | 2025-03-25 17:17:03 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,389 bytes |
コンパイル時間 | 3,548 ms |
コンパイル使用メモリ | 273,684 KB |
実行使用メモリ | 33,520 KB |
最終ジャッジ日時 | 2025-03-25 17:17:14 |
合計ジャッジ時間 | 10,121 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | TLE * 1 -- * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int n,x,a[10001],ret,now = 1e9; int lsb(int b) { return (b & (-b)); } int main(){ cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; x ^= a[i]; } if(x == 0){ cout << "Second" << endl; } else { cout << "First" << endl; bool moveMade = false; for(int i = 1; i <= n && !moveMade; i++){ int oldVal = a[i]; for(int j = 1; j <= oldVal; j++){ int newVal = oldVal - j; if((x ^ oldVal ^ newVal) == 0){ a[i] = newVal; cout << i << " " << j << endl; moveMade = true; break; } } } cin >> ret; assert(ret != -1); if(ret == 1){ return 0; } } while(1){ int idx, num; cin >> idx >> num >> ret; assert(ret != -1); if(ret == 1){ return 0; } a[idx] -= num; int er = lsb(num); for(int i = 1; i <= n; i++){ if(a[i] >= er){ cout << i <<" " << er; a[i] -= er; break; } } cin >> ret; assert(ret != -1); if(ret == 1){ return 0; } } }