# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420518 | 2021-06-08T12:16:08 Z | JvThunder | Cigle (COI21_cigle) | C++14 | 1000 ms | 332 KB |
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fir first #define sec second typedef long long ll; using namespace std; int n; vector<int> v; void solve() { cin >> n; for(int i=0;i<n;i++) { int tmp; cin >> tmp; v.pb(tmp); } int mxcnt = 0; for(int mask=0;mask<(1<<n);mask++) { int cnt = 0; set<int> prv; set<int> curr; int pos = 0; int layer = 0; bool impos = false; for(int j=1;j<n;j++) { int x1 = 0,x2 = 0; if((1<<j)&mask) x1 = 1; if((1<<(j-1))&mask) x2 = 1; if(x1==1 && x2==1) impos = true; } if(impos) continue; for(int j=0;j<n;j++) { if((1<<j)&mask) { layer++; prv.clear(); prv = curr; curr.clear(); } int sign = 1; if(layer%2) sign *= -1; pos += sign*v[j]; if(prv.find(pos)!=prv.end() && ((1<<j+1)&mask)==0 && j!=n-1) cnt++; curr.insert(pos); } mxcnt = max(mxcnt,cnt); } cout << mxcnt << endl; return; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int tc=1; //cin>>tc; for(int i=1;i<=tc;i++) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 204 KB | Output is correct |
2 | Correct | 77 ms | 204 KB | Output is correct |
3 | Correct | 53 ms | 204 KB | Output is correct |
4 | Correct | 54 ms | 204 KB | Output is correct |
5 | Correct | 60 ms | 292 KB | Output is correct |
6 | Correct | 56 ms | 204 KB | Output is correct |
7 | Correct | 54 ms | 204 KB | Output is correct |
8 | Correct | 53 ms | 204 KB | Output is correct |
9 | Correct | 69 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 204 KB | Output is correct |
2 | Correct | 77 ms | 204 KB | Output is correct |
3 | Correct | 53 ms | 204 KB | Output is correct |
4 | Correct | 54 ms | 204 KB | Output is correct |
5 | Correct | 60 ms | 292 KB | Output is correct |
6 | Correct | 56 ms | 204 KB | Output is correct |
7 | Correct | 54 ms | 204 KB | Output is correct |
8 | Correct | 53 ms | 204 KB | Output is correct |
9 | Correct | 69 ms | 204 KB | Output is correct |
10 | Incorrect | 43 ms | 300 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1067 ms | 332 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 204 KB | Output is correct |
2 | Correct | 77 ms | 204 KB | Output is correct |
3 | Correct | 53 ms | 204 KB | Output is correct |
4 | Correct | 54 ms | 204 KB | Output is correct |
5 | Correct | 60 ms | 292 KB | Output is correct |
6 | Correct | 56 ms | 204 KB | Output is correct |
7 | Correct | 54 ms | 204 KB | Output is correct |
8 | Correct | 53 ms | 204 KB | Output is correct |
9 | Correct | 69 ms | 204 KB | Output is correct |
10 | Incorrect | 43 ms | 300 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 204 KB | Output is correct |
2 | Correct | 77 ms | 204 KB | Output is correct |
3 | Correct | 53 ms | 204 KB | Output is correct |
4 | Correct | 54 ms | 204 KB | Output is correct |
5 | Correct | 60 ms | 292 KB | Output is correct |
6 | Correct | 56 ms | 204 KB | Output is correct |
7 | Correct | 54 ms | 204 KB | Output is correct |
8 | Correct | 53 ms | 204 KB | Output is correct |
9 | Correct | 69 ms | 204 KB | Output is correct |
10 | Incorrect | 43 ms | 300 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |