# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1002797 |
2024-06-19T19:47:25 Z |
Lalic |
Cigle (COI21_cigle) |
C++17 |
|
185 ms |
495476 KB |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define mp make_pair
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<double> cd;
const int MAXN = 1e5+10;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
int dp[505][505][505];
void solve(){
int n; cin >> n;
vector<int> arr(n+1); arr[0]=0;
for(int i=1;i<=n;i++) cin >> arr[i];
for(int i=3;i<=n;i++){
int sum=arr[i];
for(int c1=i-1;c1>=1;c1--){
int tot=arr[c1], best=0;
bool ok=0;
for(int c2=c1-1;c2>=1;c2--){
if(ok && tot>sum) dp[i][c1][c2]=dp[i-1][c1][c2]+1;
else if(tot==sum) ok=1;
else dp[i][c1][c2]=dp[i-1][c1][c2];
tot+=arr[c2];
best=max(best, dp[i-1][c1][c2]);
}
sum+=arr[c1];
dp[i][i][c1]=best;
}
}
int ans=0;
for(int i=0;i<n;i++) ans=max(ans, dp[n][n][i]);
cout << ans << "\n";
}
int32_t main(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
int tt=1;
//~ cin >> tt;
while(tt--) solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
185 ms |
495476 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |