結果

問題 No.1149 色塗りゲーム
ユーザー yuji9511yuji9511
提出日時 2020-08-07 22:11:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 2,131 bytes
コンパイル時間 2,181 ms
コンパイル使用メモリ 199,472 KB
実行使用メモリ 24,516 KB
平均クエリ数 5.30
最終ジャッジ日時 2023-09-24 04:32:29
合計ジャッジ時間 7,136 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
24,300 KB
testcase_01 AC 42 ms
24,324 KB
testcase_02 AC 42 ms
23,664 KB
testcase_03 AC 42 ms
23,400 KB
testcase_04 AC 42 ms
24,228 KB
testcase_05 AC 42 ms
23,532 KB
testcase_06 AC 42 ms
23,832 KB
testcase_07 AC 43 ms
24,108 KB
testcase_08 AC 42 ms
23,532 KB
testcase_09 AC 42 ms
24,048 KB
testcase_10 RE -
testcase_11 AC 44 ms
23,712 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 44 ms
24,324 KB
testcase_15 AC 44 ms
23,832 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll N;
    cin >> N;
    ll state[110] = {};
    state[N] = 1;
    while(true){
        ll K = -1,X = -1;
        ll num = 0;
        ll cnt = 0;
        bool end = false;
        // printa(state,N);
        rep(i,0,N){
            rep(k,1,3){
                if(state[i] == 1) continue;
                if(k == 2 && state[i+1] == 1) continue;
                rep(j,i,i+k){
                    state[j] = 1;
                }
                ll num = 0, res = 0;
                rep(j,0,N+1){
                    if(state[j] == 0){
                        num++;
                    }else{
                        if(num > 0){
                            res ^= num;
                            num = 0;
                        }
                    }
                }
                rep(j,i,i+k){
                    state[j] = 0;
                }
                if(res == 0){
                    end = true;
                    // print("ok",k,i);
                    K = k;
                    X = i;
                    break;
                }
            }
            if(end) break;
        }
        rep(i,X,X+K){
            state[i] = 1;
        }

        cout << K << " " << X+1 << endl;
        ll t;
        cin >> t;
        if(t == 0 || t == 2){
            return;
        }else if(t == 1){
            exit(1);
        }else{
            ll k,x;
            cin >> k >> x;
            if(k == 1){
                state[x-1] = 1;
            }else{
                state[x-1] = 1;
                state[x] = 1;
            }

        }
        
    }
    

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}
0