# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
951744 | 2024-03-22T12:36:16 Z | pcc | Super Dango Maker (JOI22_dango3) | C++17 | 226 ms | 612 KB |
#include "dango3.h" #include <bits/stdc++.h> #include <vector> using namespace std; namespace { const int mxn = 1e5+10; vector<int> perm; bitset<mxn> done; int ask(vector<int> vv){ //cerr<<"ASK:";for(auto &i:vv)cerr<<i<<' ';cerr<<endl; return Query(vv); } } // namespace /* std::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); } */ void Solve(int N, int M) { for(int i = 1;i<=N*M;i++)perm.push_back(i); mt19937 seed(time(NULL)); shuffle(perm.begin(),perm.end(),seed); for(int i = 1;i<=M;i++){ shuffle(perm.begin(),perm.end(),seed); int l = 0,r = perm.size()-1; vector<int> v; while(l != r){ int mid = (l+r)>>1; vector<int> tmp; for(int i = 0;i<=mid;i++)tmp.push_back(perm[i]); if(tmp.size()<N)l = mid+1; else if(ask(tmp) != 0)r = mid; else l = mid+1; } for(int i = 0;i<=l;i++)v.push_back(perm[i]); while(v.size()>N){ auto tmp = v.back(); v.pop_back(); if(ask(v) == 0)v.insert(v.begin(),tmp); //for(auto &j:v)cerr<<j<<' ';cerr<<endl; } for(auto &j:v)perm.erase(find(perm.begin(),perm.end(),j)); //cerr<<"ANS:";for(auto &j:v)cerr<<j<<' ';cerr<<endl; Answer(v); } return; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Correct | 2 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 348 KB | Output is correct |
2 | Correct | 22 ms | 348 KB | Output is correct |
3 | Correct | 24 ms | 348 KB | Output is correct |
4 | Correct | 23 ms | 344 KB | Output is correct |
5 | Correct | 24 ms | 348 KB | Output is correct |
6 | Correct | 25 ms | 592 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 133 ms | 612 KB | Output is correct |
2 | Correct | 226 ms | 612 KB | Output is correct |
3 | Correct | 100 ms | 600 KB | Output is correct |
4 | Correct | 104 ms | 604 KB | Output is correct |
5 | Correct | 99 ms | 612 KB | Output is correct |
6 | Correct | 105 ms | 612 KB | Output is correct |