# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
412718 | 2021-05-27T11:30:15 Z | sad | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 2 ms | 332 KB |
#include<bits/stdc++.h> #include <vector> #define ll long long #define fi first #define se second #define pb push_back #include "messy.h" using namespace std; vector<int>v;int n; int go(string s) { int one=0; for(int i=0;i<n;i++) { if(s[i]=='1'&&one)return 0; if(s[i]=='0')one=1; } return 1; } vector<int> restore_permutation(int N, int w, int r) { n=N; for(int i=0;i<n;i++)v.pb(i); for(int i=0;i<n;i++) { string s; for(int j=0;j<n;j++) { if(j<=i)s+='1'; else s+='0'; } add_element(s); s.clear(); } compile_set(); for(int i=1;i<=256;i++) { string s;int x=i; for(int j=n-1;j>-1;j--) { if((1<<j)&i)s+='1'; else s+='0'; } if(go(s))continue; if(!check_element(s))continue; int w=0,ww=0; for(int j=0;j<n;j++) { if(s[j]=='0'){w=j;break;} } for(int j=n-1;j>-1;j--) { if(s[j]=='1'){ww=j;break;} } swap(v[w],v[ww]);break; } return v; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | n = 8 |
2 | Correct | 1 ms | 204 KB | n = 8 |
3 | Correct | 1 ms | 204 KB | n = 8 |
4 | Correct | 1 ms | 204 KB | n = 8 |
5 | Correct | 1 ms | 204 KB | n = 8 |
6 | Correct | 1 ms | 204 KB | n = 8 |
7 | Correct | 1 ms | 204 KB | n = 8 |
8 | Correct | 1 ms | 204 KB | n = 8 |
9 | Correct | 1 ms | 204 KB | n = 8 |
10 | Correct | 1 ms | 204 KB | n = 8 |
11 | Correct | 1 ms | 300 KB | n = 8 |
12 | Correct | 1 ms | 204 KB | n = 8 |
13 | Correct | 1 ms | 204 KB | n = 8 |
14 | Correct | 1 ms | 204 KB | n = 8 |
15 | Correct | 1 ms | 204 KB | n = 8 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | grader returned WA |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | n = 32 |
2 | Incorrect | 1 ms | 300 KB | grader returned WA |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 292 KB | grader returned WA |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | grader returned WA |
2 | Halted | 0 ms | 0 KB | - |