답안 #1034639

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1034639 2024-07-25T15:41:00 Z vjudge1 Hacker (BOI15_hac) C++17
100 / 100
223 ms 18300 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pld pair<ld, ld>
#define pb push_back
#define fi first
#define se second
#define debug(x) cout << #x << " => " << x << endl
#define all(x) x.begin(),x.end()

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n;cin>>n;
	int m=(n+1)/2;
	int a[n],cnt[n],sum=0;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<m;i++) sum+=a[i];
	for(int i=0;i<n;i++)
	{
		cnt[i]=sum;
		sum-=a[i];
		sum+=(a[(i+m)%n]);
	}
	multiset<int> s;
	for(int i=0;i<m;i++) s.insert(cnt[i]);
	int ans=0;
	for(int i=0;i<n;i++)
	{
		ans=max(ans,*s.begin());
		s.erase(s.find(cnt[i]));
		s.insert(cnt[(i+m)%n]);
	}
	cout<<ans;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 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 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 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 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 464 KB Output is correct
23 Correct 2 ms 604 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 2 ms 600 KB Output is correct
27 Correct 0 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 1 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 632 KB Output is correct
4 Correct 27 ms 3164 KB Output is correct
5 Correct 74 ms 7252 KB Output is correct
6 Correct 87 ms 9300 KB Output is correct
7 Correct 103 ms 11196 KB Output is correct
8 Correct 223 ms 18028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 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 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 464 KB Output is correct
23 Correct 2 ms 604 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 2 ms 600 KB Output is correct
27 Correct 0 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 1 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 632 KB Output is correct
35 Correct 27 ms 3164 KB Output is correct
36 Correct 74 ms 7252 KB Output is correct
37 Correct 87 ms 9300 KB Output is correct
38 Correct 103 ms 11196 KB Output is correct
39 Correct 223 ms 18028 KB Output is correct
40 Correct 3 ms 600 KB Output is correct
41 Correct 6 ms 1112 KB Output is correct
42 Correct 8 ms 1372 KB Output is correct
43 Correct 74 ms 7568 KB Output is correct
44 Correct 206 ms 18056 KB Output is correct
45 Correct 30 ms 3672 KB Output is correct
46 Correct 109 ms 11220 KB Output is correct
47 Correct 211 ms 18260 KB Output is correct
48 Correct 165 ms 18300 KB Output is correct
49 Correct 159 ms 17744 KB Output is correct
50 Correct 144 ms 17468 KB Output is correct