結果

問題 No.1149 色塗りゲーム
ユーザー Rubikun
提出日時 2020-08-07 21:25:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 1,144 bytes
コンパイル時間 1,597 ms
コンパイル使用メモリ 167,580 KB
実行使用メモリ 25,476 KB
平均クエリ数 19.82
最終ジャッジ日時 2024-07-17 04:12:04
合計ジャッジ時間 8,282 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){

    int N;cin>>N;
    if(N==1){
        cout<<"1 1"<<endl;
        int a;cin>>a;
        return 0;
    }
    if(N==2){
        cout<<"2 1"<<endl;
        int a;cin>>a;
        return 0;
    }
    if(N&1){
        cout<<"1 "<<N/2+1<<endl;
        while(1){
            int k;cin>>k;
            if(k==0) return 0;
            int a,b;cin>>a>>b;
            if(a==1) cout<<"1 "<<N+1-b<<endl;
            else cout<<"2 "<<N+1-(b+1)<<endl;
        }
    }else{
        cout<<"2 "<<N/2<<endl;
        while(1){
            int k;cin>>k;
            if(k==0) return 0;
            int a,b;cin>>a>>b;
            if(a==1) cout<<"1 "<<N+1-b<<endl;
            else cout<<"2 "<<N+1-(b+1)<<endl;
        }
    }
}
0