Submission #949375

# Submission time Handle Problem Language Result Execution time Memory
949375 2024-03-19T07:24:52 Z Faisal_Saqib Hacker (BOI15_hac) C++17
100 / 100
406 ms 56228 KB
#include <bits/stdc++.h>
using namespace std;
const int N=5e5+100;
#define int long long
signed main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(0);
	int n;
	cin>>n;
	vector<int> a,b;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		a.push_back(x);
	}
	for(auto y:a)
		b.push_back(y);
	for(auto y:a)
		b.push_back(y);
	for(auto y:a)
		b.push_back(y);
	vector<int> pre={0};
	for(int i:b)
		pre.push_back(pre.back()+i);
	int sz=n-(n/2);
	int mx=0;
	vector<int> sp={0};
	for(int i=n+1;i<=(2*n);i++)
		sp.push_back(pre[i+sz-1]-pre[i-1]);
	for(int i=n+1;i<=(2*n);i++)
		sp.push_back(pre[i+sz-1]-pre[i-1]);
	set<pair<int,int>> tpp;
	for(int j=1;j<=sz;j++)
		tpp.insert({sp[j],j});
	mx=begin(tpp)->first;
	for(int i=sz+1;i<=(2*n);i++)
	{
		tpp.insert({sp[i],i});
		tpp.erase({sp[i-sz],i-sz});
		mx=max(mx,begin(tpp)->first);
	}
	cout<<mx<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 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 0 ms 348 KB Output is correct
15 Correct 0 ms 600 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 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 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 0 ms 348 KB Output is correct
15 Correct 0 ms 600 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 456 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 604 KB Output is correct
23 Correct 4 ms 860 KB Output is correct
24 Correct 2 ms 600 KB Output is correct
25 Correct 3 ms 860 KB Output is correct
26 Correct 3 ms 860 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 2 ms 860 KB Output is correct
31 Correct 3 ms 976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 3 ms 1016 KB Output is correct
4 Correct 46 ms 8960 KB Output is correct
5 Correct 131 ms 24064 KB Output is correct
6 Correct 165 ms 29128 KB Output is correct
7 Correct 194 ms 34608 KB Output is correct
8 Correct 402 ms 53148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 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 0 ms 348 KB Output is correct
15 Correct 0 ms 600 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 456 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 604 KB Output is correct
23 Correct 4 ms 860 KB Output is correct
24 Correct 2 ms 600 KB Output is correct
25 Correct 3 ms 860 KB Output is correct
26 Correct 3 ms 860 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 2 ms 860 KB Output is correct
31 Correct 3 ms 976 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 3 ms 1016 KB Output is correct
35 Correct 46 ms 8960 KB Output is correct
36 Correct 131 ms 24064 KB Output is correct
37 Correct 165 ms 29128 KB Output is correct
38 Correct 194 ms 34608 KB Output is correct
39 Correct 402 ms 53148 KB Output is correct
40 Correct 5 ms 1492 KB Output is correct
41 Correct 11 ms 2400 KB Output is correct
42 Correct 17 ms 3544 KB Output is correct
43 Correct 151 ms 25268 KB Output is correct
44 Correct 367 ms 54552 KB Output is correct
45 Correct 59 ms 11848 KB Output is correct
46 Correct 199 ms 32584 KB Output is correct
47 Correct 406 ms 54156 KB Output is correct
48 Correct 266 ms 54532 KB Output is correct
49 Correct 257 ms 56228 KB Output is correct
50 Correct 258 ms 55204 KB Output is correct