# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420511 | 2021-06-08T12:10:46 Z | JvThunder | Cigle (COI21_cigle) | C++14 | 1000 ms | 288 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; 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 | Execution timed out | 1078 ms | 288 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1078 ms | 288 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1082 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1078 ms | 288 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1078 ms | 288 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |