結果

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    int t, k, x;
    cin >> N;
    if(N == 1){
        cout << 1 << ' ' << 1 << endl;
        cin >> t;
        return 0;
    }
    if(N == 2){
        cout << 2 << ' ' << 1 << endl;
        cin >> t;
        return 0;
    }
    if(N%2 == 1){
        int m = N/2+1;
        cout << 1 << ' ' << m << endl;
        while(true){
            cin >> t;
            if(t <= 1) return 0;
            if(t == 2) {
                cin >> k >> x;
                return 0;
            }
            cin >> k >> x;
            if(x < m){
                cout << k << ' ' << x+m << endl;
            }else{
                cout << k << ' ' << x-m << endl;
            }
        }
    }
    if(N%2 == 0){
        int m = N/2;
        cout << 2 << ' ' << m << endl;
        while(true){
            cin >> t;
            if(t <= 1) return 0;
            if(t == 2) {
                cin >> k >> x;
                return 0;
            }
            cin >> k >> x;
            if(x < m){
                cout << k << ' ' << x+m+1 << endl;
            }else{
                cout << k << ' ' << x-m-1 << endl;
            }
        }
    }
}
0