結果
問題 | No.2978 Lexicographically Smallest and Largest Subarray |
ユーザー | kureha |
提出日時 | 2024-12-04 16:02:56 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 193 ms / 2,000 ms |
コード長 | 2,409 bytes |
コンパイル時間 | 2,111 ms |
コンパイル使用メモリ | 200,572 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 1499.00 |
最終ジャッジ日時 | 2024-12-04 16:03:14 |
合計ジャッジ時間 | 15,208 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 177 ms
24,812 KB |
testcase_01 | AC | 168 ms
24,812 KB |
testcase_02 | AC | 184 ms
24,556 KB |
testcase_03 | AC | 190 ms
25,088 KB |
testcase_04 | AC | 182 ms
25,196 KB |
testcase_05 | AC | 181 ms
25,196 KB |
testcase_06 | AC | 186 ms
24,812 KB |
testcase_07 | AC | 163 ms
24,824 KB |
testcase_08 | AC | 163 ms
24,824 KB |
testcase_09 | AC | 164 ms
24,824 KB |
testcase_10 | AC | 165 ms
24,440 KB |
testcase_11 | AC | 178 ms
25,208 KB |
testcase_12 | AC | 178 ms
24,440 KB |
testcase_13 | AC | 166 ms
25,208 KB |
testcase_14 | AC | 167 ms
25,208 KB |
testcase_15 | AC | 168 ms
24,440 KB |
testcase_16 | AC | 170 ms
24,568 KB |
testcase_17 | AC | 176 ms
24,568 KB |
testcase_18 | AC | 174 ms
24,824 KB |
testcase_19 | AC | 168 ms
24,952 KB |
testcase_20 | AC | 165 ms
24,568 KB |
testcase_21 | AC | 169 ms
25,208 KB |
testcase_22 | AC | 168 ms
24,568 KB |
testcase_23 | AC | 169 ms
24,692 KB |
testcase_24 | AC | 169 ms
25,208 KB |
testcase_25 | AC | 166 ms
24,524 KB |
testcase_26 | AC | 168 ms
24,440 KB |
testcase_27 | AC | 164 ms
25,208 KB |
testcase_28 | AC | 166 ms
24,952 KB |
testcase_29 | AC | 167 ms
25,208 KB |
testcase_30 | AC | 166 ms
24,440 KB |
testcase_31 | AC | 168 ms
24,440 KB |
testcase_32 | AC | 170 ms
24,824 KB |
testcase_33 | AC | 163 ms
24,824 KB |
testcase_34 | AC | 168 ms
24,952 KB |
testcase_35 | AC | 165 ms
25,208 KB |
testcase_36 | AC | 193 ms
24,452 KB |
testcase_37 | AC | 172 ms
24,440 KB |
testcase_38 | AC | 167 ms
24,440 KB |
testcase_39 | AC | 166 ms
25,208 KB |
testcase_40 | AC | 165 ms
25,208 KB |
testcase_41 | AC | 165 ms
25,208 KB |
testcase_42 | AC | 183 ms
25,208 KB |
testcase_43 | AC | 169 ms
25,208 KB |
testcase_44 | AC | 168 ms
25,208 KB |
testcase_45 | AC | 163 ms
24,824 KB |
testcase_46 | AC | 163 ms
24,836 KB |
testcase_47 | AC | 165 ms
24,964 KB |
testcase_48 | AC | 181 ms
25,220 KB |
testcase_49 | AC | 170 ms
24,452 KB |
testcase_50 | AC | 166 ms
24,836 KB |
testcase_51 | AC | 170 ms
24,580 KB |
testcase_52 | AC | 167 ms
24,836 KB |
testcase_53 | AC | 170 ms
25,220 KB |
testcase_54 | AC | 191 ms
24,836 KB |
testcase_55 | AC | 174 ms
24,580 KB |
testcase_56 | AC | 166 ms
25,220 KB |
ソースコード
// #pragma GCC target("avx2") // #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; using ld = long double; template<class T> using V = vector<T>; template<class T> using VV = V<V<T>>; template<class T> using VVV = V<VV<T>>; template<class T> using VVVV = VV<VV<T>>; #define rep(i,n) for(ll i=0ll;(i)<(n);(i)++) #define REP(i,a,n) for(ll i=(a);(i)<(n);(i)++) #define rrep(i,n) for(ll i=(n)-1;(i)>=(0ll);(i)--) #define RREP(i,a,n) for(ll i=(n)-1;(i)>=(a);(i)--) const long long INF = (1LL << 60); const long long mod99 = 998244353; const long long mod107 = 1000000007; const long long mod = mod99; #define eb emplace_back #define be(v) (v).begin(),(v).end() #define all(i,v) for(auto& (i) : (v)) #define UQ(v) sort(be(v)), (v).erase(unique(be(v)), (v).end()) #define UQ2(v,cmp) sort(be(v)), (v).erase(unique(be(v),cmp), (v).end()) #define UQ3(v,cmp) sort(be(v),cmp), (v).erase(unique(be(v)), (v).end()) #define UQ4(v,cmp,cmp2) sort(be(v), cmp), (v).erase(unique(be(v),cmp2), (v).end()) #define LB(x,v) (lower_bound(be(v),(x))-(v).begin()) #define LB2(x,v,cmp) (lower_bound(be(v),(x),(cmp))-(v).begin()) #define UB(x,v) (upper_bound(be(v),(x))-(v).begin()) #define UB2(x,v,cmp) (upper_bound(be(v),(x),(cmp))-(v).begin()) #define dout() cout << fixed << setprecision(20) #define randinit() srand((unsigned)time(NULL)) template<class T, class U> bool chmin(T& t, const U& u) { if (t > u){ t = u; return 1;} return 0; } template<class T, class U> bool chmax(T& t, const U& u) { if (t < u){ t = u; return 1;} return 0; } ll Rnd(ll L=0, ll R=mod99){return rand()%(R-L)+L;} ll query(ll l, ll r, ll L, ll R){ cout << "? " << l << ' ' << r << ' ' << L << ' ' << R << endl; ll t; cin >> t; return t; } void solve(){ ll n,q; cin >> n >> q; ll a,b; if(query(1, n, 2, n)){ a = 1; b = 2; }else{ a = 2; b = 1; } for(ll i=3; i<n; i+=2){ ll c = i, d = i+1; if(query(d, n, c, n)) swap(c, d); if(query(c, n, a, n)) swap(a, c); if(query(b, n, d, n)) swap(b, d); } cout << "! " << a << " " << a << " " << b << " " << n << endl; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int t=1; // cin >> t; rep(i,t) solve(); }