# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
544575 | 2022-04-02T11:23:08 Z | Rafi22 | Super Dango Maker (JOI22_dango3) | C++17 | 2533 ms | 724 KB |
#include <bits/stdc++.h> #include "dango3.h" using namespace std; #define endl '\n' #define st first #define nd second #define pb push_back #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define ll long long namespace { ll mod=1000000007; int inf=1000000007; ll infl=1000000000000000007; bool taken[407*27]; bool was[27]; } // namespace void Solve(int n,int m) { srand(time(NULL)); vector<int>ord(n*m); for(int i=0;i<n*m;i++) ord[i]=i+1; random_shuffle(all(ord)); vector<int>ans[m]; for(auto x:ord) { memset(was,0,sizeof was); while(true) { int i=rand()%m; if(was[i]||sz(ans[i])==n) continue; was[i]=1; taken[x]=1; for(auto y:ans[i]) taken[y]=1; vector<int> Z; for(int j=1;j<=n*m;j++) if(!taken[j]) Z.pb(j); if(Query(Z)==m-1) { ans[i].pb(x); for(auto y:ans[i]) taken[y]=0; break; } for(auto y:ans[i]) taken[y]=0; taken[x]=0; } } for(int i=0;i<m;i++) { Answer(ans[i]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 372 KB | Output is correct |
2 | Correct | 19 ms | 376 KB | Output is correct |
3 | Correct | 23 ms | 340 KB | Output is correct |
4 | Correct | 20 ms | 340 KB | Output is correct |
5 | Correct | 21 ms | 380 KB | Output is correct |
6 | Correct | 21 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 637 ms | 588 KB | Output is correct |
2 | Correct | 624 ms | 580 KB | Output is correct |
3 | Correct | 626 ms | 468 KB | Output is correct |
4 | Correct | 604 ms | 488 KB | Output is correct |
5 | Correct | 607 ms | 492 KB | Output is correct |
6 | Correct | 594 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2528 ms | 588 KB | Output is correct |
2 | Correct | 2525 ms | 628 KB | Output is correct |
3 | Correct | 2533 ms | 588 KB | Output is correct |
4 | Correct | 2489 ms | 700 KB | Output is correct |
5 | Correct | 2396 ms | 724 KB | Output is correct |
6 | Correct | 2465 ms | 624 KB | Output is correct |