結果
| 問題 |
No.1149 色塗りゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-07 21:54:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 137 ms / 2,000 ms |
| コード長 | 729 bytes |
| コンパイル時間 | 710 ms |
| コンパイル使用メモリ | 70,408 KB |
| 最終ジャッジ日時 | 2025-01-12 16:45:43 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include <iostream>
#include <vector>
void query(int k, int x) {
std::cout << k << " " << x << std::endl;
}
std::pair<int, int> get() {
int t;
std::cin >> t;
if (t <= 1) std::exit(0);
int k, x;
std::cin >> k >> x;
if (t == 2) std::exit(0);
return std::make_pair(k, x);
}
void solve() {
int n;
std::cin >> n;
if (n % 2 == 0) {
query(2, n / 2);
} else {
query(1, (n + 1) / 2);
}
while (true) {
auto [k, x] = get();
if (k == 1) {
query(1, n - x + 1);
} else {
query(2, n - x);
}
}
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}