# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
821245 | 2023-08-11T08:19:38 Z | PVM_pvm | Watermelon (INOI20_watermelon) | C++17 | 427 ms | 732 KB |
#include<bits/stdc++.h> using namespace std; #define MAXN 12 int b[MAXN],n,k; struct perm { int ch[MAXN]; perm(int a[]) { for (int q=1;q<=n;q++) ch[q]=a[q]; } void show() { //cout<<"P:"; for (int q=1;q<=n;q++) cout<<ch[q]<<" "; cout<<"\n"; } }; vector<perm> ans; int cur[MAXN],sb[MAXN]; bool dt[MAXN]; void check() { for (int q=1;q<=n;q++) sb[q]=-1; for (int q=1;q<=n;q++) dt[q]=false; for (int tm=1;true;tm++) { bool smyrt=false; for (int q=1;q<=n;q++) { if (dt[q]) continue; int next=q+1; for (next=q+1;next<=n;next++) { if (!dt[next]) break; } if (next>n) break; if (cur[next]>cur[q]) { dt[q]=true; smyrt=true; sb[q]=tm; } } if (!smyrt) break; } bool pr=true; for (int q=1;q<=n;q++) { if (sb[q]!=b[q]) pr=false; } if (pr) { perm spr(cur); ans.push_back(spr); } } int main() { cin>>n>>k; for (int q=1;q<=n;q++) cin>>b[q]; for (int q=1;q<=n;q++) cur[q]=q; check(); while (next_permutation(cur+1,cur+n+1)) check(); if (k<ans.size()) ans[k-1].show(); else cout<<"-1\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 212 KB | Output is correct |
2 | Correct | 36 ms | 320 KB | Output is correct |
3 | Correct | 427 ms | 732 KB | Output is correct |
4 | Correct | 373 ms | 280 KB | Output is correct |
5 | Correct | 377 ms | 280 KB | Output is correct |
6 | Correct | 33 ms | 276 KB | Output is correct |
7 | Correct | 396 ms | 288 KB | Output is correct |
8 | Correct | 386 ms | 276 KB | Output is correct |
9 | Correct | 36 ms | 276 KB | Output is correct |
10 | Correct | 33 ms | 212 KB | Output is correct |
11 | Correct | 4 ms | 300 KB | Output is correct |
12 | Correct | 381 ms | 452 KB | Output is correct |
13 | Correct | 387 ms | 552 KB | Output is correct |
14 | Correct | 385 ms | 368 KB | Output is correct |
15 | Correct | 388 ms | 408 KB | Output is correct |
16 | Incorrect | 396 ms | 468 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 212 KB | Output is correct |
2 | Correct | 36 ms | 320 KB | Output is correct |
3 | Correct | 427 ms | 732 KB | Output is correct |
4 | Correct | 373 ms | 280 KB | Output is correct |
5 | Correct | 377 ms | 280 KB | Output is correct |
6 | Correct | 33 ms | 276 KB | Output is correct |
7 | Correct | 396 ms | 288 KB | Output is correct |
8 | Correct | 386 ms | 276 KB | Output is correct |
9 | Correct | 36 ms | 276 KB | Output is correct |
10 | Correct | 33 ms | 212 KB | Output is correct |
11 | Correct | 4 ms | 300 KB | Output is correct |
12 | Correct | 381 ms | 452 KB | Output is correct |
13 | Correct | 387 ms | 552 KB | Output is correct |
14 | Correct | 385 ms | 368 KB | Output is correct |
15 | Correct | 388 ms | 408 KB | Output is correct |
16 | Incorrect | 396 ms | 468 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 212 KB | Output is correct |
2 | Correct | 36 ms | 320 KB | Output is correct |
3 | Correct | 427 ms | 732 KB | Output is correct |
4 | Correct | 373 ms | 280 KB | Output is correct |
5 | Correct | 377 ms | 280 KB | Output is correct |
6 | Correct | 33 ms | 276 KB | Output is correct |
7 | Correct | 396 ms | 288 KB | Output is correct |
8 | Correct | 386 ms | 276 KB | Output is correct |
9 | Correct | 36 ms | 276 KB | Output is correct |
10 | Correct | 33 ms | 212 KB | Output is correct |
11 | Correct | 4 ms | 300 KB | Output is correct |
12 | Correct | 381 ms | 452 KB | Output is correct |
13 | Correct | 387 ms | 552 KB | Output is correct |
14 | Correct | 385 ms | 368 KB | Output is correct |
15 | Correct | 388 ms | 408 KB | Output is correct |
16 | Incorrect | 396 ms | 468 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |