# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
570342 | 2022-05-29T09:00:10 Z | Spade1 | Library (JOI18_library) | C++14 | 1 ms | 336 KB |
#include<bits/stdc++.h> #include "library.h" #define pii pair<int, int> #define pll pair<long long, long long> #define ll long long #define ld long double #define st first #define nd second #define pb push_back #define INF INT_MAX using namespace std; bool mark[1010]; void Solve(int N) { int l = 2, r = N; vector<int> ans; ans.pb(1); vector<int> rmn; for (int i = 2; i <= N; ++i) rmn.pb(i); while (true) { int l = 0, r = rmn.size(); while (l < r) { vector<int> tst(N, 0); int mid = (l+r+1)/2; for (int i = 0; i <= mid; ++i) { tst[rmn[i]-1] = 1; } int tmp = Query(tst); tst[ans.back()-1] = 1; if (Query(tst) > tmp) r = mid-1; else l = mid; } if (l == rmn.size()) break; else { ans.pb(rmn[l]); rmn.erase(rmn.begin()+l); } } reverse(ans.begin(), ans.end()); while (true) { int l = 0, r = rmn.size(); while (l < r) { vector<int> tst(N, 0); int mid = (l+r+1)/2; for (int i = 0; i <= mid; ++i) { tst[rmn[i]-1] = 1; } int tmp = Query(tst); tst[ans.back()-1] = 1; if (Query(tst) > tmp) r = mid-1; else l = mid; } if (l == rmn.size()) break; else { ans.pb(rmn[l]); rmn.erase(rmn.begin()+l); } } Answer(ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |