結果
| 問題 |
No.2978 Lexicographically Smallest and Largest Subarray
|
| コンテスト | |
| ユーザー |
houren
|
| 提出日時 | 2024-12-02 00:37:23 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,123 bytes |
| コンパイル時間 | 3,757 ms |
| コンパイル使用メモリ | 277,776 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 2.00 |
| 最終ジャッジ日時 | 2024-12-02 00:37:45 |
| 合計ジャッジ時間 | 18,193 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 57 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fix(x) fixed << setprecision(x)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
constexpr ll INFLL = (1LL << 62), MOD = 998244353;
constexpr int INF = (1 << 30);
bool query(int l1, int r1, int l2, int r2){
cout << "? " << l1 << " " << r1 << " " << l2 << " " << r2 << endl;
int res;
cin >> res;
assert(res!=-1);
return res;
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<vector<int>> a(2);
rep(i,n/2){
int x = query(2*i,2*i,2*i+1,2*i+1);
a[x].emplace_back(2*i+1);
a[!x].emplace_back(2*i);
}
int p = a[0][0], q = a[1][0];
for(int i=1;i<n/2;++i){
if(query(a[0][i],a[0][i],p,p)) p = a[0][i];
if(query(q,n-1,a[1][i],n-1)) q = a[1][i];
}
cout << "! " << p+1 << " " << p+1 << " " << q+1 << " " << n << endl;
return 0;
}
houren