結果
| 問題 |
No.850 企業コンテスト2位
|
| コンテスト | |
| ユーザー |
QCFium
|
| 提出日時 | 2019-07-12 14:18:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 879 bytes |
| コンパイル時間 | 1,565 ms |
| コンパイル使用メモリ | 172,924 KB |
| 実行使用メモリ | 40,400 KB |
| 最終ジャッジ日時 | 2024-07-16 17:47:53 |
| 合計ジャッジ時間 | 7,980 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | TLE * 1 -- * 26 |
ソースコード
#include <bits/stdc++.h>
int main() {
int n;
scanf("%d", &n);
std::vector<int> x;
for (int i = 0; i < n; i++) x.push_back(i);
std::vector<std::pair<int, int> > log;
while (x.size() > 1) {
std::vector<int> next;
for (int i = 0; i < x.size() / 2; i++) {
log.push_back({x[2 * i], x[2 * i + 1]});
printf("? %d %d\n", log.back().first + 1, log.back().second + 1);
int cur;
scanf("%d", &cur);
next.push_back(cur - 1);
}
x.swap(next);
}
std::vector<int> y;
for (auto &i : log) {
if (i.first == x[0]) y.push_back(i.second);
if (i.second == x[0]) y.push_back(i.first);
}
while (y.size() > 1) {
std::vector<int> next;
for (int i = 0; i < y.size() / 2; i++) {
printf("? %d %d\n", y[2 * i] + 1, y[2 * i + 1] + 1);
int cur;
scanf("%d", &cur);
next.push_back(cur - 1);
}
y.swap(next);
}
printf("! %d\n", y[0] + 1);
return 0;
}
QCFium