結果

問題 No.1149 色塗りゲーム
ユーザー Ricky_ponRicky_pon
提出日時 2020-08-07 21:56:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 1,403 bytes
コンパイル時間 1,950 ms
コンパイル使用メモリ 201,224 KB
実行使用メモリ 24,360 KB
平均クエリ数 19.82
最終ジャッジ日時 2023-09-24 04:26:40
合計ジャッジ時間 7,901 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
24,360 KB
testcase_01 AC 43 ms
23,988 KB
testcase_02 AC 41 ms
23,988 KB
testcase_03 AC 43 ms
23,484 KB
testcase_04 AC 42 ms
24,276 KB
testcase_05 AC 41 ms
23,424 KB
testcase_06 AC 41 ms
23,364 KB
testcase_07 AC 41 ms
23,988 KB
testcase_08 AC 43 ms
23,340 KB
testcase_09 AC 42 ms
23,376 KB
testcase_10 AC 43 ms
23,700 KB
testcase_11 AC 43 ms
23,580 KB
testcase_12 AC 44 ms
23,424 KB
testcase_13 AC 43 ms
23,652 KB
testcase_14 AC 43 ms
23,496 KB
testcase_15 AC 43 ms
24,324 KB
testcase_16 AC 43 ms
24,240 KB
testcase_17 AC 44 ms
24,204 KB
testcase_18 AC 43 ms
23,796 KB
testcase_19 AC 44 ms
23,484 KB
testcase_20 AC 45 ms
24,204 KB
testcase_21 AC 45 ms
24,312 KB
testcase_22 AC 46 ms
23,364 KB
testcase_23 AC 46 ms
24,096 KB
testcase_24 AC 46 ms
23,352 KB
testcase_25 AC 46 ms
23,964 KB
testcase_26 AC 46 ms
23,604 KB
testcase_27 AC 46 ms
24,096 KB
testcase_28 AC 47 ms
24,336 KB
testcase_29 AC 48 ms
23,568 KB
testcase_30 AC 85 ms
23,292 KB
testcase_31 AC 80 ms
24,012 KB
testcase_32 AC 83 ms
23,580 KB
testcase_33 AC 85 ms
24,240 KB
testcase_34 AC 89 ms
23,352 KB
testcase_35 AC 84 ms
24,252 KB
testcase_36 AC 93 ms
23,892 KB
testcase_37 AC 94 ms
24,000 KB
testcase_38 AC 88 ms
23,496 KB
testcase_39 AC 94 ms
23,412 KB
testcase_40 AC 100 ms
23,508 KB
testcase_41 AC 97 ms
24,240 KB
testcase_42 AC 96 ms
24,252 KB
testcase_43 AC 96 ms
23,340 KB
testcase_44 AC 104 ms
23,448 KB
testcase_45 AC 102 ms
23,376 KB
testcase_46 AC 105 ms
23,964 KB
testcase_47 AC 113 ms
24,000 KB
testcase_48 AC 110 ms
23,484 KB
testcase_49 AC 115 ms
24,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

pii interact(int k, int x){
    cout << k << " " << x << endl;
    int t;
    cin >> t;
    assert(t != 1);
    if(t == 0) return {-1, -1};
    cin >> k >> x;
    if(t == 2) return {-1, -1};
    return {k, x};
}

int main(){
    int n;
    cin >> n;
    int k, x;
    if(n % 2 == 0) tie(k, x) = interact(2, n/2);
    else tie(k, x) = interact(1, n/2+1);
    if(k < 0) return 0;
    while(true){
        x = n+1 - x;
        if(k == 2) --x;
        tie(k, x) = interact(k, x);
        if(k < 0) return 0;
    }
}
0