結果

問題 No.3120 Lower Nim
ユーザー ponjuice
提出日時 2025-04-17 11:58:28
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,207 bytes
コンパイル時間 8,754 ms
コンパイル使用メモリ 351,276 KB
実行使用メモリ 26,468 KB
平均クエリ数 77.30
最終ジャッジ日時 2025-04-17 11:58:44
合計ジャッジ時間 15,801 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 WA * 6 RE * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const ll min_n = 1;
const ll max_n = 40;

const ll min_a = 1;
const ll max_a = 10000;

const ll min_sum = 1;
const ll max_sum = 10000;

int main(){
    registerValidation();

    ll n = inf.readInt(min_n, max_n);
    inf.readEoln();

    vector<ll> a(n);
    ll sum = 0;
    for (ll i = 0; i < n; i++){
        a[i] = inf.readInt(min_a, max_a);
        sum += a[i];
        if (i != n - 1) inf.readSpace();
    }
    inf.readEoln();

    cout << "First" << endl;

    while(true){
        for(int i = 0; i < n; i++) {
            if(a[i] != 0) {
                cout << i + 1 << " " << 1 << endl;
                a[i]--;
                break;
            }
        }
        int res = inf.readInt(-1, 1);
        inf.readEoln();
        if(res == -1 || res == 1) {
            break;
        }

        int i = inf.readInt(1, n) - 1;
        inf.readSpace();
        int x = inf.readInt(1, 1);
        inf.readEoln();
        assert(a[i] >= x);
        a[i] -= x;

        res = inf.readInt(-1, 1);
        inf.readEoln();
        if(res == -1 || res == 1) {
            break;
        }
    }
    inf.readEof();

}
0