結果

問題 No.1149 色塗りゲーム
ユーザー yutasyutas
提出日時 2020-08-07 22:24:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,638 bytes
コンパイル時間 1,489 ms
コンパイル使用メモリ 165,348 KB
実行使用メモリ 24,252 KB
平均クエリ数 0.12
最終ジャッジ日時 2023-09-24 04:36:37
合計ジャッジ時間 5,297 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
23,640 KB
testcase_01 AC 34 ms
23,988 KB
testcase_02 AC 33 ms
24,252 KB
testcase_03 AC 33 ms
8,076 KB
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:47:11: 警告: ‘R’ may be used uninitialized [-Wmaybe-uninitialized]
   47 |     }else if (L + 1 == R){
      |           ^~
main.cpp:37:12: 備考: ‘R’ はここで定義されています
   37 |     int L, R;
      |            ^
main.cpp:48:27: 警告: ‘L’ may be used uninitialized [-Wmaybe-uninitialized]
   48 |       cout << 2 << " " << L << endl;
      |                           ^
main.cpp:37:9: 備考: ‘L’ はここで定義されています
   37 |     int L, R;
      |         ^

ソースコード

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 main(){
  cin >> N;

  int rest = N;
  while (rest > 0){
    bool flag = false;
    int L, R;
    for (int i = 1; i <= N; i++){
      if (!visited[i]){
        if (!flag) flag = true, L = i;
        R = i;
      }
    }
    if (L == R){
      cout << 1 << " " << L << endl;
      return 0;
    }else if (L + 1 == R){
      cout << 2 << " " << L << endl;
      return 0;
    }else{
      if (rest % 2 == 1){
        for (int i = L + 1; i <= N; i++){
          if (!visited[i]){
            visited[i] = true;
            cout << 1 << " " << i << endl;
            break;
          }
        }
        rest--;
      }else{
        for (int i = L + 1; i < N; i++){
          if (!visited[i] && !visited[i+1]){
            cout << 2 << " " << i << endl;
            visited[i] = true; visited[i + 1] =  true;
          }
        }
        rest -= 2;
      }

      int T; cin >> T;
      if (T != 3) return 0;

      int K, X; cin >> K >> X;
      rest -= K;
      for (int i = 0; i < K; i++){
        visited[X + i] = true;
      }
    }

  }

  return 0;
}
0