結果
| 問題 |
No.2978 Lexicographically Smallest and Largest Subarray
|
| コンテスト | |
| ユーザー |
Iroha_3856
|
| 提出日時 | 2024-12-01 21:48:41 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 194 ms / 2,000 ms |
| コード長 | 1,393 bytes |
| コンパイル時間 | 3,417 ms |
| コンパイル使用メモリ | 249,888 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 1499.00 |
| 最終ジャッジ日時 | 2024-12-01 23:35:22 |
| 合計ジャッジ時間 | 15,875 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 57 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using mint = atcoder::modint998244353;
#define rep(i, l, r) for (int i = (int)(l); i<(int)(r); i++)
#define ll long long
int main() {
int N, Q; cin >> N >> Q;
vector<int> lose, win;
for (int i = 0; i < 500; i++) {
cout << "? " << 2*i+1 << " " << N << " " << 2*i+2 << " " << N << endl;
int res; cin >> res;
if (res == 1) {
//[2*i:] < [2*i+1:]
lose.push_back(2*i);
win.push_back(2*i+1);
}
else {
//[2*i:] > [2*i+1:]
lose.push_back(2*i+1);
win.push_back(2*i);
}
}
int loselose, winwin;
loselose = 0;
for (int i = 1; i < 500; i++) {
//loseloseを決める
cout << "? " << lose[loselose]+1 << " " << lose[loselose]+1 << " " << lose[i]+1 << " " << lose[i]+1 << endl;
int res; cin >> res;
if (res == 0) {
//loselose > i
loselose = i;
}
}
winwin = 0;
for (int i = 1; i < 500; i++) {
cout << "? " << win[winwin]+1 << " " << N << " " << win[i]+1 << " " << N << endl;
int res; cin >> res;
if (res == 1) {
//winwin < i
winwin = i;
}
}
cout << "! " << lose[loselose]+1 << " " << lose[loselose]+1 << " " << win[winwin]+1 << " " << N << endl;
}
Iroha_3856