結果
| 問題 |
No.1149 色塗りゲーム
|
| コンテスト | |
| ユーザー |
yutas
|
| 提出日時 | 2020-08-07 22:24:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,638 bytes |
| コンパイル時間 | 1,650 ms |
| コンパイル使用メモリ | 167,704 KB |
| 実行使用メモリ | 43,040 KB |
| 平均クエリ数 | 0.12 |
| 最終ジャッジ日時 | 2024-07-17 04:50:43 |
| 合計ジャッジ時間 | 5,602 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 TLE * 1 -- * 45 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:47:11: warning: 'R' may be used uninitialized [-Wmaybe-uninitialized]
47 | }else if (L + 1 == R){
| ^~
main.cpp:37:12: note: 'R' was declared here
37 | int L, R;
| ^
main.cpp:48:27: warning: 'L' may be used uninitialized [-Wmaybe-uninitialized]
48 | cout << 2 << " " << L << endl;
| ^
main.cpp:37:9: note: 'L' was declared here
37 | int L, R;
| ^
ソースコード
#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;
}
yutas