結果
問題 |
No.3120 Lower Nim
|
ユーザー |
![]() |
提出日時 | 2025-04-18 22:08:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 245 ms / 2,000 ms |
コード長 | 929 bytes |
コンパイル時間 | 4,362 ms |
コンパイル使用メモリ | 251,312 KB |
実行使用メモリ | 25,972 KB |
平均クエリ数 | 2685.91 |
最終ジャッジ日時 | 2025-04-18 22:08:35 |
合計ジャッジ時間 | 12,755 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 43 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001LL int main(){ int n; cin>>n; vector<int> a(n); rep(i,n)cin>>a[i]; bool f = false; rep(i,30){ int c = 0; rep(j,n){ if((a[j]>>i)&1)c ^= 1; } if(c)f = true; } if(f)cout<<"First"<<endl; else cout<<"Second"<<endl; while(true){ if(f){ rep(i,30){ int c = 0; rep(j,n){ if((a[j]>>i)&1)c ^= 1; } if(c){ rep(j,n){ if((a[j]>>i)&1){ cout<<j+1<<' '<<(1<<i)<<endl; a[j] -= (1<<i); break; } } break; } } int res; cin>>res; assert(res!=-1); if(res==1)return 0; } f = true; int i,x; cin>>i>>x; a[i-1] -= x; int res; cin>>res; assert(res!=-1); } return 0; }