Submission #108931

# Submission time Handle Problem Language Result Execution time Memory
108931 2019-05-03T03:24:58 Z autumn_eel Gap (APIO16_gap) C++14
0 / 100
64 ms 3596 KB
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

#include "gap.h"


ll solve1(int n){
	deque<ll>f,r;
	while(f.size()+r.size()<n){
		ll mn,mx;
		ll L=(f.empty()?0:f.back()+1),R=(r.empty()?1e18:r.front()-1);
		MinMax(L,R,&mn,&mx);
		f.push_back(mn);
		if(mn!=mx)r.push_front(mx);
	}
	while(!r.empty()){
		f.push_back(r.front());
		r.pop_front();
	}
	assert(f.size()==n);
	ll ans=0;
	rep(i,n-1)ans=max(ans,f[i+1]-f[i]);
	return ans;
}
ll solve2(int n){
	return 0;
}

long long findGap(int T, int N){
	if(T==1)return solve1(N);
	return solve2(N);
}

Compilation message

gap.cpp: In function 'll solve1(int)':
gap.cpp:11:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(f.size()+r.size()<n){
        ~~~~~~~~~~~~~~~~~^~
In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from gap.cpp:1:
gap.cpp:22:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  assert(f.size()==n);
         ~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 3 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Correct 2 ms 384 KB Output is correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 3 ms 384 KB Output isn't correct
8 Incorrect 2 ms 384 KB Output isn't correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Correct 2 ms 384 KB Output is correct
11 Incorrect 3 ms 384 KB Output isn't correct
12 Incorrect 3 ms 384 KB Output isn't correct
13 Incorrect 3 ms 304 KB Output isn't correct
14 Incorrect 3 ms 384 KB Output isn't correct
15 Correct 3 ms 384 KB Output is correct
16 Incorrect 13 ms 996 KB Output isn't correct
17 Incorrect 14 ms 1024 KB Output isn't correct
18 Incorrect 14 ms 1024 KB Output isn't correct
19 Incorrect 15 ms 1024 KB Output isn't correct
20 Correct 11 ms 896 KB Output is correct
21 Incorrect 54 ms 3596 KB Output isn't correct
22 Incorrect 64 ms 3576 KB Output isn't correct
23 Incorrect 55 ms 3576 KB Output isn't correct
24 Incorrect 49 ms 3580 KB Output isn't correct
25 Correct 43 ms 2936 KB Output is correct
26 Incorrect 60 ms 3576 KB Output isn't correct
27 Incorrect 58 ms 3576 KB Output isn't correct
28 Incorrect 53 ms 3576 KB Output isn't correct
29 Incorrect 44 ms 3548 KB Output isn't correct
30 Correct 55 ms 2424 KB Output is correct
31 Incorrect 3 ms 384 KB Output isn't correct
32 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Incorrect 2 ms 384 KB Output isn't correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 2 ms 384 KB Output isn't correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Incorrect 2 ms 384 KB Output isn't correct
11 Incorrect 2 ms 384 KB Output isn't correct
12 Incorrect 2 ms 384 KB Output isn't correct
13 Incorrect 3 ms 384 KB Output isn't correct
14 Incorrect 3 ms 384 KB Output isn't correct
15 Incorrect 3 ms 384 KB Output isn't correct
16 Incorrect 9 ms 768 KB Output isn't correct
17 Incorrect 11 ms 740 KB Output isn't correct
18 Incorrect 12 ms 768 KB Output isn't correct
19 Incorrect 10 ms 768 KB Output isn't correct
20 Incorrect 7 ms 512 KB Output isn't correct
21 Incorrect 30 ms 2752 KB Output isn't correct
22 Incorrect 30 ms 2808 KB Output isn't correct
23 Incorrect 31 ms 2808 KB Output isn't correct
24 Incorrect 35 ms 2808 KB Output isn't correct
25 Incorrect 23 ms 2168 KB Output isn't correct
26 Incorrect 31 ms 2808 KB Output isn't correct
27 Incorrect 29 ms 2808 KB Output isn't correct
28 Incorrect 32 ms 2736 KB Output isn't correct
29 Incorrect 31 ms 2808 KB Output isn't correct
30 Incorrect 16 ms 1536 KB Output isn't correct
31 Incorrect 2 ms 384 KB Output isn't correct
32 Incorrect 2 ms 384 KB Output isn't correct