Submission #55142

# Submission time Handle Problem Language Result Execution time Memory
55142 2018-07-06T06:22:28 Z khsoo01(#2065) None (JOI14_ho_t3) C++11
20 / 100
24 ms 892 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 100005, inf = 1e12;

ll n, a[2*N], nxt[N];

bool can (ll V) {
	for(ll S=0, E=-1, X=0; S < n;) {
		if(X >= V) {
			nxt[S] = E+1;
			X -= a[S];
			S++;
		}
		else {
			E++;
			X += a[E];
		}
	}
	for(ll i=0;i<n;i++) {
		ll C = i, l = 0;
		for(ll j=0;j<3;j++) {
			l += nxt[C] - C;
			C = nxt[C] % n;
		}
		if(l <= n) return true;
	}
	return false;
}

int main()
{
	scanf("%lld",&n);
	for(ll i=0;i<n;i++) {
		scanf("%lld",&a[i]);
		a[i+n] = a[i];
	}
	ll S = 0, E = inf;
	while(S<E) {
		ll M = (S+E)/2+1;
		can(M) ? S = M : E = M-1;
	}
	printf("%lld\n",S);
}

Compilation message

2014_ho_t3.cpp: In function 'int main()':
2014_ho_t3.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
2014_ho_t3.cpp:35:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 416 KB Output is correct
2 Correct 8 ms 488 KB Output is correct
3 Correct 9 ms 488 KB Output is correct
4 Correct 9 ms 488 KB Output is correct
5 Correct 8 ms 500 KB Output is correct
6 Correct 3 ms 528 KB Output is correct
7 Correct 3 ms 528 KB Output is correct
8 Correct 4 ms 700 KB Output is correct
9 Correct 3 ms 700 KB Output is correct
10 Correct 4 ms 700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 416 KB Output is correct
2 Correct 8 ms 488 KB Output is correct
3 Correct 9 ms 488 KB Output is correct
4 Correct 9 ms 488 KB Output is correct
5 Correct 8 ms 500 KB Output is correct
6 Correct 3 ms 528 KB Output is correct
7 Correct 3 ms 528 KB Output is correct
8 Correct 4 ms 700 KB Output is correct
9 Correct 3 ms 700 KB Output is correct
10 Correct 4 ms 700 KB Output is correct
11 Correct 9 ms 700 KB Output is correct
12 Correct 9 ms 700 KB Output is correct
13 Correct 9 ms 724 KB Output is correct
14 Correct 24 ms 724 KB Output is correct
15 Correct 7 ms 724 KB Output is correct
16 Correct 5 ms 724 KB Output is correct
17 Correct 4 ms 724 KB Output is correct
18 Correct 4 ms 724 KB Output is correct
19 Correct 4 ms 724 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 416 KB Output is correct
2 Correct 8 ms 488 KB Output is correct
3 Correct 9 ms 488 KB Output is correct
4 Correct 9 ms 488 KB Output is correct
5 Correct 8 ms 500 KB Output is correct
6 Correct 3 ms 528 KB Output is correct
7 Correct 3 ms 528 KB Output is correct
8 Correct 4 ms 700 KB Output is correct
9 Correct 3 ms 700 KB Output is correct
10 Correct 4 ms 700 KB Output is correct
11 Correct 9 ms 700 KB Output is correct
12 Correct 9 ms 700 KB Output is correct
13 Correct 9 ms 724 KB Output is correct
14 Correct 24 ms 724 KB Output is correct
15 Correct 7 ms 724 KB Output is correct
16 Correct 5 ms 724 KB Output is correct
17 Correct 4 ms 724 KB Output is correct
18 Correct 4 ms 724 KB Output is correct
19 Correct 4 ms 724 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
21 Correct 16 ms 892 KB Output is correct
22 Correct 14 ms 892 KB Output is correct
23 Correct 21 ms 892 KB Output is correct
24 Correct 22 ms 892 KB Output is correct
25 Correct 15 ms 892 KB Output is correct
26 Incorrect 7 ms 892 KB Output isn't correct
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 416 KB Output is correct
2 Correct 8 ms 488 KB Output is correct
3 Correct 9 ms 488 KB Output is correct
4 Correct 9 ms 488 KB Output is correct
5 Correct 8 ms 500 KB Output is correct
6 Correct 3 ms 528 KB Output is correct
7 Correct 3 ms 528 KB Output is correct
8 Correct 4 ms 700 KB Output is correct
9 Correct 3 ms 700 KB Output is correct
10 Correct 4 ms 700 KB Output is correct
11 Correct 9 ms 700 KB Output is correct
12 Correct 9 ms 700 KB Output is correct
13 Correct 9 ms 724 KB Output is correct
14 Correct 24 ms 724 KB Output is correct
15 Correct 7 ms 724 KB Output is correct
16 Correct 5 ms 724 KB Output is correct
17 Correct 4 ms 724 KB Output is correct
18 Correct 4 ms 724 KB Output is correct
19 Correct 4 ms 724 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
21 Correct 16 ms 892 KB Output is correct
22 Correct 14 ms 892 KB Output is correct
23 Correct 21 ms 892 KB Output is correct
24 Correct 22 ms 892 KB Output is correct
25 Correct 15 ms 892 KB Output is correct
26 Incorrect 7 ms 892 KB Output isn't correct
27 Halted 0 ms 0 KB -