# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1088332 | 2024-09-14T09:01:42 Z | vjudge1 | Discharging (NOI20_discharging) | C++17 | 65 ms | 17744 KB |
#include<bits/stdc++.h> #define taskname "" #define el '\n' #define fi first #define sc second #define pii pair<int, int> #define all(v) v.begin(), v.end() #define int long long using namespace std; #define Faster ios_base::sync_with_stdio(false);cin.tie(0); const int maxn=1e6+33; const int N=1e5; const int mod=1e9+7; const long long INF=1e18+2; int n,cost[1505][1505],a[maxn]; int dp[maxn]; void sub1() { for(int i=1;i<=n;i++) { cost[i][i]=a[i]; for(int j=i+1;j<=n;j++) { cost[i][j]=max(cost[i][j-1],a[j]); } } for(int i=1;i<=n;i++) { dp[i]=cost[1][i]*n; for(int j=1;j<i;j++) { dp[i]=min(dp[i],dp[j]+cost[j+1][i]*(n-j)); } } cout<<dp[n]; } void sub2() { } signed main() { if (fopen(taskname".INP","r")) { freopen(taskname".INP","r",stdin); freopen(taskname".OUT","w",stdout); } Faster cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } if(n<=1500) sub1(); else sub2(); }
Compilation message
# | Verdict | Execution time | Memory | 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 468 KB | Output is correct |
14 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 13916 KB | Output is correct |
2 | Correct | 9 ms | 13404 KB | Output is correct |
3 | Correct | 8 ms | 13724 KB | Output is correct |
4 | Correct | 8 ms | 13148 KB | Output is correct |
5 | Correct | 10 ms | 14064 KB | Output is correct |
6 | Correct | 8 ms | 13660 KB | Output is correct |
7 | Correct | 9 ms | 13660 KB | Output is correct |
8 | Correct | 8 ms | 13148 KB | Output is correct |
9 | Correct | 9 ms | 14048 KB | Output is correct |
10 | Correct | 8 ms | 13148 KB | Output is correct |
11 | Correct | 9 ms | 13916 KB | Output is correct |
12 | Correct | 8 ms | 13660 KB | Output is correct |
13 | Correct | 9 ms | 13288 KB | Output is correct |
14 | Correct | 8 ms | 14172 KB | Output is correct |
15 | Correct | 7 ms | 13404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 13916 KB | Output is correct |
2 | Correct | 9 ms | 13404 KB | Output is correct |
3 | Correct | 8 ms | 13724 KB | Output is correct |
4 | Correct | 8 ms | 13148 KB | Output is correct |
5 | Correct | 10 ms | 14064 KB | Output is correct |
6 | Correct | 8 ms | 13660 KB | Output is correct |
7 | Correct | 9 ms | 13660 KB | Output is correct |
8 | Correct | 8 ms | 13148 KB | Output is correct |
9 | Correct | 9 ms | 14048 KB | Output is correct |
10 | Correct | 8 ms | 13148 KB | Output is correct |
11 | Correct | 9 ms | 13916 KB | Output is correct |
12 | Correct | 8 ms | 13660 KB | Output is correct |
13 | Correct | 9 ms | 13288 KB | Output is correct |
14 | Correct | 8 ms | 14172 KB | Output is correct |
15 | Correct | 7 ms | 13404 KB | Output is correct |
16 | Incorrect | 62 ms | 13136 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 65 ms | 17744 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 468 KB | Output is correct |
14 | Correct | 1 ms | 344 KB | Output is correct |
15 | Correct | 11 ms | 13916 KB | Output is correct |
16 | Correct | 9 ms | 13404 KB | Output is correct |
17 | Correct | 8 ms | 13724 KB | Output is correct |
18 | Correct | 8 ms | 13148 KB | Output is correct |
19 | Correct | 10 ms | 14064 KB | Output is correct |
20 | Correct | 8 ms | 13660 KB | Output is correct |
21 | Correct | 9 ms | 13660 KB | Output is correct |
22 | Correct | 8 ms | 13148 KB | Output is correct |
23 | Correct | 9 ms | 14048 KB | Output is correct |
24 | Correct | 8 ms | 13148 KB | Output is correct |
25 | Correct | 9 ms | 13916 KB | Output is correct |
26 | Correct | 8 ms | 13660 KB | Output is correct |
27 | Correct | 9 ms | 13288 KB | Output is correct |
28 | Correct | 8 ms | 14172 KB | Output is correct |
29 | Correct | 7 ms | 13404 KB | Output is correct |
30 | Correct | 7 ms | 13400 KB | Output is correct |
31 | Correct | 9 ms | 13912 KB | Output is correct |
32 | Correct | 7 ms | 13148 KB | Output is correct |
33 | Correct | 7 ms | 13660 KB | Output is correct |
34 | Correct | 8 ms | 13148 KB | Output is correct |
35 | Correct | 8 ms | 13916 KB | Output is correct |
36 | Correct | 7 ms | 13916 KB | Output is correct |
37 | Correct | 7 ms | 13916 KB | Output is correct |
38 | Correct | 8 ms | 13916 KB | Output is correct |
39 | Correct | 7 ms | 13912 KB | Output is correct |
40 | Correct | 6 ms | 13148 KB | Output is correct |
41 | Correct | 7 ms | 13824 KB | Output is correct |
42 | Correct | 8 ms | 14072 KB | Output is correct |
43 | Correct | 8 ms | 14168 KB | Output is correct |
44 | Correct | 7 ms | 13404 KB | Output is correct |
45 | Correct | 7 ms | 13580 KB | Output is correct |
46 | Correct | 7 ms | 13404 KB | Output is correct |
47 | Correct | 8 ms | 14172 KB | Output is correct |
48 | Correct | 9 ms | 13148 KB | Output is correct |
49 | Correct | 9 ms | 13144 KB | Output is correct |
50 | Correct | 7 ms | 13272 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 468 KB | Output is correct |
14 | Correct | 1 ms | 344 KB | Output is correct |
15 | Correct | 11 ms | 13916 KB | Output is correct |
16 | Correct | 9 ms | 13404 KB | Output is correct |
17 | Correct | 8 ms | 13724 KB | Output is correct |
18 | Correct | 8 ms | 13148 KB | Output is correct |
19 | Correct | 10 ms | 14064 KB | Output is correct |
20 | Correct | 8 ms | 13660 KB | Output is correct |
21 | Correct | 9 ms | 13660 KB | Output is correct |
22 | Correct | 8 ms | 13148 KB | Output is correct |
23 | Correct | 9 ms | 14048 KB | Output is correct |
24 | Correct | 8 ms | 13148 KB | Output is correct |
25 | Correct | 9 ms | 13916 KB | Output is correct |
26 | Correct | 8 ms | 13660 KB | Output is correct |
27 | Correct | 9 ms | 13288 KB | Output is correct |
28 | Correct | 8 ms | 14172 KB | Output is correct |
29 | Correct | 7 ms | 13404 KB | Output is correct |
30 | Incorrect | 62 ms | 13136 KB | Output isn't correct |
31 | Halted | 0 ms | 0 KB | - |