# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
553716 | 2022-04-26T16:37:06 Z | amunduzbaev | Super Dango Maker (JOI22_dango3) | C++17 | 1354 ms | 736 KB |
#include "dango3.h" #ifndef EVAL #include "grader.cpp" #endif #include "bits/stdc++.h" using namespace std; void Solve(int n, int m) { vector<int> a(n * m); iota(a.begin(), a.end(), 0); for(int i=m;i>1;i--){ int cnt = 0; int j=n*i-1; vector<int> tmp; auto ask = [&](int j){ vector<int> tt; for(int i=0;i<=j;i++) tt.push_back(a[i] + 1); for(auto x : tmp) tt.push_back(a[x] + 1); cnt++; return Query(tt); }; int cc = 0; while(~j){ cc++; if(ask(j)){ if(!j) { tmp.push_back(j); break; } j = max(j - i, 0); } else { int l = j, r = min(j + i, tmp.empty() ? n * m : tmp.back() - 1); while(l < r){ int m = (l + r) >> 1; if(ask(m)) r = m; else l = m + 1; } assert(l == r); tmp.push_back(l); j = max(l - i, 0); } } assert(cc <= 2 * n); // cout<<cnt<<" "<<n * max(1., ceil(log(i)))<<" "<<2 * n<<"\n"; // assert(cnt <= n * max(1., ceil(log(i))) + 2 * n); auto give = [&](vector<int>& tt){ reverse(tt.begin(), tt.end()); /* for(auto x : tt) cout<<x<<" "; cout<<"\n"; for(auto x : a) cout<<x<<" "; cout<<"\n"; */ vector<int> tmp, qq; for(int j=0, l=0;j<n*i;j++){ if(l<n && tt[l] == j) { qq.push_back(a[j] + 1); l++; continue; } tmp.push_back(a[j]); } swap(tmp, a); Answer(qq); assert(qq.size() == n); }; assert(tmp.size() == n); give(tmp); } for(auto& x : a) x++; Answer(a); } /* 3 2 3 3 1 2 1 2 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 368 KB | Output is correct |
2 | Correct | 9 ms | 340 KB | Output is correct |
3 | Correct | 15 ms | 340 KB | Output is correct |
4 | Correct | 15 ms | 340 KB | Output is correct |
5 | Correct | 7 ms | 340 KB | Output is correct |
6 | Correct | 6 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 141 ms | 484 KB | Output is correct |
2 | Correct | 138 ms | 484 KB | Output is correct |
3 | Correct | 360 ms | 464 KB | Output is correct |
4 | Correct | 336 ms | 464 KB | Output is correct |
5 | Correct | 113 ms | 468 KB | Output is correct |
6 | Correct | 110 ms | 468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 534 ms | 532 KB | Output is correct |
2 | Correct | 519 ms | 588 KB | Output is correct |
3 | Correct | 1314 ms | 736 KB | Output is correct |
4 | Correct | 1354 ms | 612 KB | Output is correct |
5 | Correct | 385 ms | 636 KB | Output is correct |
6 | Correct | 413 ms | 564 KB | Output is correct |