結果
| 問題 | 
                            No.3120 Lower Nim
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-04-19 17:22:50 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,832 bytes | 
| コンパイル時間 | 2,318 ms | 
| コンパイル使用メモリ | 196,288 KB | 
| 実行使用メモリ | 26,356 KB | 
| 平均クエリ数 | 1.95 | 
| 最終ジャッジ日時 | 2025-04-19 17:23:06 | 
| 合計ジャッジ時間 | 14,774 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 1 | 
| other | AC * 1 RE * 42 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int k = 1e9;
    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] && a[sel] - (a[sel] ^ x) <= k){
                    sel = i;
                    break;
                }
            }
            assert(sel != -1);
            cout << sel + 1 << " " << a[sel] - (a[sel] ^ x) << endl;
            k = a[sel] - (a[sel] ^ x);
            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;
            k = 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;
            k = 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] && a[i] - (a[i] ^ x) < k){
                    sel = i;
                    val = a[i] - (a[i] ^ x);
                    a[i] ^= x;
                    break;
                }
            }
            k = val;
            assert(sel != -1);
            cout << sel + 1 << " " << val << endl;
        }
    }
}