結果

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

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1149.cc:  No.1149 色塗りゲーム - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

void sendans(int k, int x) {
  printf("%d %d\n", k, x + 1); fflush(stdout);
}

/* main */

int main() {
  int n;
  scanf("%d", &n);

  int l = (n - 1) / 2, p = n - l;
  sendans(p - l, l);

  for (;;) {
    int t;
    scanf("%d", &t);
    if (t <= 1) break;

    int k, x;
    scanf("%d%d", &k, &x);
    x--;
    if (t == 2) break;

    sendans(k, (x >= p) ? x - p : x + p);
  }
  return 0;
}
0