# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
554621 | 2022-04-29T00:30:19 Z | Arvin | Super Dango Maker (JOI22_dango3) | C++17 | 841 ms | 274156 KB |
#include "dango3.h" #include <bits/stdc++.h> using namespace std; //namespace { // int variable_example = 1; //} // namespace map<vector<int>, int> mp; void Solve(int n, int m) { int len = n*m; vector<int> v; for(int x=0;x<len;x++){ v.push_back(x+1); } auto ask = [&](vector<int> &v) -> int { if(mp.count(v)) return mp[v]; return mp[v] = Query(v); }; int cnt = m; while(cnt > 0){ vector<int> w = v; vector<int> ans; int pos = 0; while(pos < w.size()){ int bound = 0; int left = pos, right = w.size()-1; while(left <= right){ int mid = (left+right) >> 1; vector<int> z = ans; for(int x=mid;x<w.size();x++){ z.push_back(w[x]); } if(ask(z) > 0){ bound = mid; left = mid+1; } else { right = mid-1; } } ans.push_back(w[bound]); pos = bound+1; } v.clear(); pos = 0; for(int x=0;x<w.size();x++){ while(pos < ans.size() && ans[pos] < w[x]){ pos++; } if(pos < ans.size() && ans[pos] == w[x]) continue; v.push_back(w[x]); } Answer(ans); cnt--; } // vector<int> x(3); // x[0] = 1; // x[1] = 2; // x[2] = 3; // variable_example = Query(x); // for (int i = 0; i < M; i++) { // std::vector<int> a(N); // for (int j = 0; j < N; j++) { // a[j] = N * i + j + 1; // } // Answer(a); // } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Correct | 0 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 352 KB | Output is correct |
4 | Correct | 0 ms | 352 KB | Output is correct |
5 | Correct | 0 ms | 352 KB | Output is correct |
6 | Correct | 1 ms | 352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 3976 KB | Output is correct |
2 | Correct | 18 ms | 3808 KB | Output is correct |
3 | Correct | 40 ms | 10476 KB | Output is correct |
4 | Correct | 39 ms | 10452 KB | Output is correct |
5 | Correct | 13 ms | 2320 KB | Output is correct |
6 | Correct | 13 ms | 2336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 277 ms | 56380 KB | Output is correct |
2 | Correct | 273 ms | 56192 KB | Output is correct |
3 | Correct | 828 ms | 274156 KB | Output is correct |
4 | Correct | 841 ms | 274144 KB | Output is correct |
5 | Correct | 163 ms | 22448 KB | Output is correct |
6 | Correct | 153 ms | 22548 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 757 ms | 171996 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |