답안 #887224

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887224 2023-12-14T05:48:16 Z zeta7532 Cigle (COI21_cigle) C++17
48 / 100
1000 ms 98644 KB
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = int;
const ll mod = 998244353;
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define faster ios::sync_with_stdio(false);cin.tie(nullptr)

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    vector<vector<ll>> ep(N,vector<ll>(N,0));
    for(ll j=0;j<N;j++){
        unordered_map<ll,ll> M;
        ll cnt_l=0;
        for(ll i=j;i>=0;i--){
            ll cnt=0;
            ll cnt_r=0;
            if(i>0&&ep[i-1][j]>=ep[i][j]){
                
            }else for(ll k=j+1;k<N;k++){
                ep[j+1][k]=max(ep[j+1][k],ep[i][j]+cnt);
                cnt++;
                cnt_r+=A[k];
                if(M[cnt_r]==0) cnt--;
            }
            cnt_l+=A[i];
            M[cnt_l]++;
        }
    }
    ll ans=0;
    rep(i,N) ans=max(ans,ep[i][N-1]);
    cout << ans << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 1436 KB Output is correct
2 Correct 71 ms 1372 KB Output is correct
3 Correct 56 ms 1628 KB Output is correct
4 Correct 63 ms 1432 KB Output is correct
5 Correct 58 ms 1372 KB Output is correct
6 Correct 64 ms 1368 KB Output is correct
7 Correct 61 ms 1400 KB Output is correct
8 Correct 66 ms 1372 KB Output is correct
9 Correct 64 ms 1368 KB Output is correct
10 Correct 68 ms 1432 KB Output is correct
11 Correct 70 ms 1368 KB Output is correct
12 Correct 78 ms 1368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 54 ms 1436 KB Output is correct
22 Correct 71 ms 1372 KB Output is correct
23 Correct 56 ms 1628 KB Output is correct
24 Correct 63 ms 1432 KB Output is correct
25 Correct 58 ms 1372 KB Output is correct
26 Correct 64 ms 1368 KB Output is correct
27 Correct 61 ms 1400 KB Output is correct
28 Correct 66 ms 1372 KB Output is correct
29 Correct 64 ms 1368 KB Output is correct
30 Correct 68 ms 1432 KB Output is correct
31 Correct 70 ms 1368 KB Output is correct
32 Correct 78 ms 1368 KB Output is correct
33 Correct 54 ms 1436 KB Output is correct
34 Correct 55 ms 1368 KB Output is correct
35 Correct 59 ms 1372 KB Output is correct
36 Correct 59 ms 1432 KB Output is correct
37 Correct 64 ms 1372 KB Output is correct
38 Correct 68 ms 1616 KB Output is correct
39 Correct 72 ms 1432 KB Output is correct
40 Correct 23 ms 1368 KB Output is correct
41 Correct 106 ms 1432 KB Output is correct
42 Correct 87 ms 1368 KB Output is correct
43 Correct 103 ms 1616 KB Output is correct
44 Correct 59 ms 1368 KB Output is correct
45 Correct 91 ms 1432 KB Output is correct
46 Correct 83 ms 1436 KB Output is correct
47 Correct 71 ms 1368 KB Output is correct
48 Correct 79 ms 1372 KB Output is correct
49 Correct 99 ms 1432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 54 ms 1436 KB Output is correct
22 Correct 71 ms 1372 KB Output is correct
23 Correct 56 ms 1628 KB Output is correct
24 Correct 63 ms 1432 KB Output is correct
25 Correct 58 ms 1372 KB Output is correct
26 Correct 64 ms 1368 KB Output is correct
27 Correct 61 ms 1400 KB Output is correct
28 Correct 66 ms 1372 KB Output is correct
29 Correct 64 ms 1368 KB Output is correct
30 Correct 68 ms 1432 KB Output is correct
31 Correct 70 ms 1368 KB Output is correct
32 Correct 78 ms 1368 KB Output is correct
33 Correct 54 ms 1436 KB Output is correct
34 Correct 55 ms 1368 KB Output is correct
35 Correct 59 ms 1372 KB Output is correct
36 Correct 59 ms 1432 KB Output is correct
37 Correct 64 ms 1372 KB Output is correct
38 Correct 68 ms 1616 KB Output is correct
39 Correct 72 ms 1432 KB Output is correct
40 Correct 23 ms 1368 KB Output is correct
41 Correct 106 ms 1432 KB Output is correct
42 Correct 87 ms 1368 KB Output is correct
43 Correct 103 ms 1616 KB Output is correct
44 Correct 59 ms 1368 KB Output is correct
45 Correct 91 ms 1432 KB Output is correct
46 Correct 83 ms 1436 KB Output is correct
47 Correct 71 ms 1368 KB Output is correct
48 Correct 79 ms 1372 KB Output is correct
49 Correct 99 ms 1432 KB Output is correct
50 Execution timed out 1056 ms 98644 KB Time limit exceeded
51 Halted 0 ms 0 KB -