답안 #887219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887219 2023-12-14T05:34:46 Z zeta7532 Cigle (COI21_cigle) C++17
48 / 100
1000 ms 98604 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;
            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 600 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 600 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 2 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 1620 KB Output is correct
2 Correct 105 ms 1372 KB Output is correct
3 Correct 106 ms 1372 KB Output is correct
4 Correct 106 ms 1432 KB Output is correct
5 Correct 106 ms 1372 KB Output is correct
6 Correct 107 ms 1436 KB Output is correct
7 Correct 107 ms 1368 KB Output is correct
8 Correct 108 ms 1436 KB Output is correct
9 Correct 111 ms 1624 KB Output is correct
10 Correct 113 ms 1372 KB Output is correct
11 Correct 112 ms 1436 KB Output is correct
12 Correct 115 ms 1372 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 600 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 2 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 108 ms 1620 KB Output is correct
22 Correct 105 ms 1372 KB Output is correct
23 Correct 106 ms 1372 KB Output is correct
24 Correct 106 ms 1432 KB Output is correct
25 Correct 106 ms 1372 KB Output is correct
26 Correct 107 ms 1436 KB Output is correct
27 Correct 107 ms 1368 KB Output is correct
28 Correct 108 ms 1436 KB Output is correct
29 Correct 111 ms 1624 KB Output is correct
30 Correct 113 ms 1372 KB Output is correct
31 Correct 112 ms 1436 KB Output is correct
32 Correct 115 ms 1372 KB Output is correct
33 Correct 106 ms 1372 KB Output is correct
34 Correct 106 ms 1372 KB Output is correct
35 Correct 106 ms 1372 KB Output is correct
36 Correct 107 ms 1432 KB Output is correct
37 Correct 108 ms 1368 KB Output is correct
38 Correct 107 ms 1428 KB Output is correct
39 Correct 137 ms 1372 KB Output is correct
40 Correct 192 ms 1440 KB Output is correct
41 Correct 183 ms 1368 KB Output is correct
42 Correct 158 ms 1440 KB Output is correct
43 Correct 184 ms 1436 KB Output is correct
44 Correct 182 ms 1616 KB Output is correct
45 Correct 181 ms 1368 KB Output is correct
46 Correct 171 ms 1372 KB Output is correct
47 Correct 171 ms 1368 KB Output is correct
48 Correct 177 ms 1372 KB Output is correct
49 Correct 180 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 600 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 2 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 108 ms 1620 KB Output is correct
22 Correct 105 ms 1372 KB Output is correct
23 Correct 106 ms 1372 KB Output is correct
24 Correct 106 ms 1432 KB Output is correct
25 Correct 106 ms 1372 KB Output is correct
26 Correct 107 ms 1436 KB Output is correct
27 Correct 107 ms 1368 KB Output is correct
28 Correct 108 ms 1436 KB Output is correct
29 Correct 111 ms 1624 KB Output is correct
30 Correct 113 ms 1372 KB Output is correct
31 Correct 112 ms 1436 KB Output is correct
32 Correct 115 ms 1372 KB Output is correct
33 Correct 106 ms 1372 KB Output is correct
34 Correct 106 ms 1372 KB Output is correct
35 Correct 106 ms 1372 KB Output is correct
36 Correct 107 ms 1432 KB Output is correct
37 Correct 108 ms 1368 KB Output is correct
38 Correct 107 ms 1428 KB Output is correct
39 Correct 137 ms 1372 KB Output is correct
40 Correct 192 ms 1440 KB Output is correct
41 Correct 183 ms 1368 KB Output is correct
42 Correct 158 ms 1440 KB Output is correct
43 Correct 184 ms 1436 KB Output is correct
44 Correct 182 ms 1616 KB Output is correct
45 Correct 181 ms 1368 KB Output is correct
46 Correct 171 ms 1372 KB Output is correct
47 Correct 171 ms 1368 KB Output is correct
48 Correct 177 ms 1372 KB Output is correct
49 Correct 180 ms 1368 KB Output is correct
50 Execution timed out 1060 ms 98604 KB Time limit exceeded
51 Halted 0 ms 0 KB -