結果
| 問題 |
No.1149 色塗りゲーム
|
| コンテスト | |
| ユーザー |
mot
|
| 提出日時 | 2020-08-07 22:37:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 140 ms / 2,000 ms |
| コード長 | 1,925 bytes |
| コンパイル時間 | 862 ms |
| コンパイル使用メモリ | 86,096 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 19.82 |
| 最終ジャッジ日時 | 2024-07-17 04:57:10 |
| 合計ジャッジ時間 | 7,635 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);
int main() {
int N;
cin>>N;
string S;
int a[N];
for(int i=0;i<N;++i) {
a[i] = 0;
}
int t;
int k, x;
for(int i=0;i<N;++i) {
if(i==0) {
if(N%2==0) {
a[N/2-1] = 1;
a[N/2] = 1;
cout<<2<<" "<<N/2<<endl;
}
else {
a[N/2] = 1;
cout<<1<<" "<<N/2+1<<endl;
}
}
else {
int ans;
bool two;
for(int j=0;j<N;++j) {
if(a[j]!=a[N-1-j]) {
if(a[j]==0) {
ans = j+1;
if(a[j+1]!=a[N-2-j]) {
a[j] = 1;
a[j+1] = 1;
two = true;
}
else {
a[j] = 1;
two = false;
}
}
else {
ans = N-j;
if(a[j+1]!=a[N-2-j]) {
a[N-1-j] = 1;
a[N-2-j] = 1;
ans = N-1-j;
two = true;
}
else {
a[N-1-j] = 1;
two = false;
}
}
break;
}
}
if(two) {
cout<<2<<" "<<ans<<endl;
}
else {
cout<<1<<" "<<ans<<endl;
}
}
cin>>t;
if(t==0) return 0;
if(t==0 || t==1 || t==2) return 0;
cin>>k>>x;
x--;
for(int j=0;j<N;++j) {
if(j==x) {
if(k==1) a[x] = 1;
else {
a[x] = 1;
a[x+1] = 1;
}
break;
}
}
}
}
mot