結果

問題 No.1149 色塗りゲーム
ユーザー yutasyutas
提出日時 2020-08-07 23:05:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,478 bytes
コンパイル時間 1,642 ms
コンパイル使用メモリ 164,728 KB
実行使用メモリ 37,224 KB
平均クエリ数 0.08
最終ジャッジ日時 2023-09-24 04:55:55
合計ジャッジ時間 5,551 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;
bool visited[105];

int Count(){
  int cnt = 0;
  for (int i = 1; i <= N; i++){
    if (visited[i-1] && !visited[i] && visited[i+1]) cnt++;
  }
  return cnt;
}

int Solve(){
  for (int i = 1; i < N; i++){
    if (visited[i] || visited[i+1]) continue;

    visited[i] = true; visited[i+1] = true;
    if (Count() % 2 == 0){
      cout << 2 << " " << i << endl;
      return 0;
    }
    visited[i] = false; visited[i+1] = false;
    }
  for (int i = 1; i <= N; i++){
    if (visited[i]) continue;

    visited[i] = true;
    if (Count() % 2 == 0){
      cout << 1 << " " << i << endl;
      return 0;
    }
    visited[i] = false;
  }
  return 0;
}

int main(){
  cin >> N;
  visited[0] = true; visited[N+1] = true;
  for (int i = 0; i < N; i++){
    Solve();
    int T; cin >> T;
    if (T != 3) break;
    int K, X; cin >> K >> X;
    for (int j = 0; j < K; j++){
      visited[X + j] = true;
    }
  }

  return 0;
}
0