# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
863917 | 2023-10-21T12:39:50 Z | Rifal | Cigle (COI21_cigle) | C++14 | 1000 ms | 596 KB |
#include <bits/stdc++.h> #include <fstream> //#define endl '\n' #define mod 1000000007 #define INF 900000000 using namespace std; //ofstream fout("intel.out"); //ifstream fin("intel.in"); int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n; cin >> n; int arr[n]; for(int i = 0; i < n; i++) { cin >> arr[i]; } int sol = 0; for(int i = 0; i < (1<<n); i++) { vector<long long> v, v2; long long sum = 0; int ans = 0; for(int j = 0; j < n; j++) { if((i&(1<<j)) > 0) { v.push_back(arr[j]); sum += arr[j]; if(!v2.empty() && v2.size() != 1 && j != n-1 && (i&(1<<(j+1)) > 0 )) { while(v2.size() > 1 && sum >= v2.back()) { if(sum == v2.back()) ans++; sum -= v2.back(); v2.pop_back(); } } } else { v2 = v; sum = arr[j]; if(!v2.empty() && v2.size() != 1 && j != n-1 && (i&(1<<(j+1)) > 0)) { while(v2.size() > 1 && sum >= v2.back()) { if(sum == v2.back()) ans++; sum -= v2.back(); v2.pop_back(); } } v.clear(); v.push_back(arr[j]); } } sol = max(sol,ans); } cout << sol; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 295 ms | 428 KB | Output is correct |
2 | Correct | 280 ms | 348 KB | Output is correct |
3 | Correct | 285 ms | 428 KB | Output is correct |
4 | Correct | 284 ms | 424 KB | Output is correct |
5 | Incorrect | 286 ms | 448 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 295 ms | 428 KB | Output is correct |
2 | Correct | 280 ms | 348 KB | Output is correct |
3 | Correct | 285 ms | 428 KB | Output is correct |
4 | Correct | 284 ms | 424 KB | Output is correct |
5 | Incorrect | 286 ms | 448 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1057 ms | 596 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 295 ms | 428 KB | Output is correct |
2 | Correct | 280 ms | 348 KB | Output is correct |
3 | Correct | 285 ms | 428 KB | Output is correct |
4 | Correct | 284 ms | 424 KB | Output is correct |
5 | Incorrect | 286 ms | 448 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 295 ms | 428 KB | Output is correct |
2 | Correct | 280 ms | 348 KB | Output is correct |
3 | Correct | 285 ms | 428 KB | Output is correct |
4 | Correct | 284 ms | 424 KB | Output is correct |
5 | Incorrect | 286 ms | 448 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |