| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1002859 | hyakup | Cigle (COI21_cigle) | C++17 | 77 ms | 4692 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define bug(x) cout << #x << " " << x << endl;
#define pii pair<int, int>
const int inf = 1e9 + 10;
const int maxn = 500 + 10;
const int maxm = 3e7 + 10;
vector<int> v( maxn );
ll dp[maxn][maxn];
bool marc[maxm];
int main(){
int n; cin >> n;
for( int i = 1; i <= n; i++ ) cin >> v[i];
ll resp = 0;
for( int a = 1; a <= n; a++){
for( int b = 1; b < a; b++ ){
int sum = 0;
for( int i = b + 1; i < a; i++ ){
sum += v[i];
marc[sum] = true;
}
sum = 0;
ll& ans = dp[a][b];
int cont = 0;
for( int c = b - 1; c >= 0; c-- ){
if( marc[sum] ) cont++;
sum += v[c + 1];
ans = max( ans, dp[b][c] + cont );
}
sum = 0;
for( int i = b + 1; i < a; i++ ){
sum += v[i];
marc[sum] = false;
}
resp = max( resp, ans );
}
}
cout << resp << endl;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
