Submission #966611

# Submission time Handle Problem Language Result Execution time Memory
966611 2024-04-20T06:40:30 Z Trisanu_Das Discharging (NOI20_discharging) C++17
47 / 100
299 ms 20396 KB
# include <bits/stdc++.h>
using namespace std;
long long b[1000005], n,a[1000005],mn,mx,raod,x,w,ww;
pair <long long ,long long > dp[1000005];
int main()
{
	cin>>n;
	a[0]=1e9;
	for (int i=1; i<=n; i++) {
		cin>>a[i];
		mx=max(mx,a[i]);
		if (a[i]>a[i-1]) ww=1;
	}
	if (n>1500) {
	    cout<<mx*n<<endl;
	    return 0;
	}
	dp[0]={0,0};
	dp[1]={a[1]+(n-1)*a[1],a[1]};
	for (int i=2; i<=n; i++) {
		dp[i].first=1e18;
		x=0;
		for (int j=i; j>=1; j--) {
			x=max(x,a[j]);
			dp[i].first=min(dp[i].first, dp[j-1].first+(n-j+1)*x);
			
		}
	}
	cout<<dp[n].first;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4600 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4700 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 2 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4444 KB Output is correct
2 Correct 3 ms 4444 KB Output is correct
3 Correct 3 ms 4444 KB Output is correct
4 Correct 2 ms 4444 KB Output is correct
5 Correct 3 ms 4552 KB Output is correct
6 Correct 4 ms 4440 KB Output is correct
7 Correct 3 ms 4444 KB Output is correct
8 Correct 3 ms 4444 KB Output is correct
9 Correct 3 ms 4444 KB Output is correct
10 Correct 4 ms 4440 KB Output is correct
11 Correct 3 ms 4440 KB Output is correct
12 Correct 3 ms 4440 KB Output is correct
13 Correct 2 ms 4444 KB Output is correct
14 Correct 3 ms 4552 KB Output is correct
15 Correct 3 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4444 KB Output is correct
2 Correct 3 ms 4444 KB Output is correct
3 Correct 3 ms 4444 KB Output is correct
4 Correct 2 ms 4444 KB Output is correct
5 Correct 3 ms 4552 KB Output is correct
6 Correct 4 ms 4440 KB Output is correct
7 Correct 3 ms 4444 KB Output is correct
8 Correct 3 ms 4444 KB Output is correct
9 Correct 3 ms 4444 KB Output is correct
10 Correct 4 ms 4440 KB Output is correct
11 Correct 3 ms 4440 KB Output is correct
12 Correct 3 ms 4440 KB Output is correct
13 Correct 2 ms 4444 KB Output is correct
14 Correct 3 ms 4552 KB Output is correct
15 Correct 3 ms 4444 KB Output is correct
16 Incorrect 172 ms 15696 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 291 ms 20356 KB Output is correct
2 Correct 274 ms 20256 KB Output is correct
3 Correct 277 ms 20396 KB Output is correct
4 Correct 271 ms 20304 KB Output is correct
5 Correct 279 ms 20304 KB Output is correct
6 Correct 272 ms 20272 KB Output is correct
7 Correct 272 ms 20284 KB Output is correct
8 Correct 278 ms 20276 KB Output is correct
9 Correct 287 ms 20136 KB Output is correct
10 Correct 299 ms 20308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4600 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4700 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 2 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4440 KB Output is correct
15 Correct 3 ms 4444 KB Output is correct
16 Correct 3 ms 4444 KB Output is correct
17 Correct 3 ms 4444 KB Output is correct
18 Correct 2 ms 4444 KB Output is correct
19 Correct 3 ms 4552 KB Output is correct
20 Correct 4 ms 4440 KB Output is correct
21 Correct 3 ms 4444 KB Output is correct
22 Correct 3 ms 4444 KB Output is correct
23 Correct 3 ms 4444 KB Output is correct
24 Correct 4 ms 4440 KB Output is correct
25 Correct 3 ms 4440 KB Output is correct
26 Correct 3 ms 4440 KB Output is correct
27 Correct 2 ms 4444 KB Output is correct
28 Correct 3 ms 4552 KB Output is correct
29 Correct 3 ms 4444 KB Output is correct
30 Correct 2 ms 4440 KB Output is correct
31 Correct 3 ms 4444 KB Output is correct
32 Correct 2 ms 4700 KB Output is correct
33 Correct 2 ms 4444 KB Output is correct
34 Correct 2 ms 4440 KB Output is correct
35 Correct 3 ms 4440 KB Output is correct
36 Correct 3 ms 4444 KB Output is correct
37 Correct 3 ms 4444 KB Output is correct
38 Correct 2 ms 4444 KB Output is correct
39 Correct 3 ms 4444 KB Output is correct
40 Correct 3 ms 4444 KB Output is correct
41 Correct 2 ms 4564 KB Output is correct
42 Correct 3 ms 4444 KB Output is correct
43 Correct 3 ms 4444 KB Output is correct
44 Correct 2 ms 4444 KB Output is correct
45 Correct 2 ms 4444 KB Output is correct
46 Correct 2 ms 4444 KB Output is correct
47 Correct 3 ms 4444 KB Output is correct
48 Correct 2 ms 4444 KB Output is correct
49 Correct 2 ms 4816 KB Output is correct
50 Correct 2 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4600 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4700 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 2 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4440 KB Output is correct
15 Correct 3 ms 4444 KB Output is correct
16 Correct 3 ms 4444 KB Output is correct
17 Correct 3 ms 4444 KB Output is correct
18 Correct 2 ms 4444 KB Output is correct
19 Correct 3 ms 4552 KB Output is correct
20 Correct 4 ms 4440 KB Output is correct
21 Correct 3 ms 4444 KB Output is correct
22 Correct 3 ms 4444 KB Output is correct
23 Correct 3 ms 4444 KB Output is correct
24 Correct 4 ms 4440 KB Output is correct
25 Correct 3 ms 4440 KB Output is correct
26 Correct 3 ms 4440 KB Output is correct
27 Correct 2 ms 4444 KB Output is correct
28 Correct 3 ms 4552 KB Output is correct
29 Correct 3 ms 4444 KB Output is correct
30 Incorrect 172 ms 15696 KB Output isn't correct
31 Halted 0 ms 0 KB -