# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420514 | 2021-06-08T12:13:03 Z | JvThunder | Cigle (COI21_cigle) | C++14 | 1 ms | 204 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; for(int j=1;j<n;j++) { int x1,x2; if((1<<j)&mask) x1 = 1; if((1<<j-1)&mask) x2 = 1; if(x1==x2 && x2==1) impos = true; } if(impos) break; 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 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |