結果

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';
signed main() {
    int n;
    cin >> n;
    if (n % 2 == 0) {
        cout << 2 << ' ' << n/2 << endl;
        while (1) {
            int tp;
            cin >> tp;
            if (tp == 0)
                exit(0);
            assert(tp == 3);

            int t, p;
            cin >> t >> p;
            int sh = n/2+1;
            if (p <= n/2) {
                cout << t << ' ' << p + sh << endl;
            }   
            else {
                cout << t << ' ' << p - sh << endl;
            }   
        }   
    }   
    else {
        cout << 1 << ' ' << n/2 + 1 << endl;
        while (1) {
            int tp;
            cin >> tp;
            if (tp == 0)
                exit(0);
            assert(tp == 3);

            int t, p;
            cin >> t >> p;
            int sh = n/2+1;
            if (p <= n/2) {
                cout << t << ' ' << p + sh << endl;
            }   
            else {
                cout << t << ' ' << p - sh << endl;
            }   
        }   
    }   
}
0