Submission #1091033

# Submission time Handle Problem Language Result Execution time Memory
1091033 2024-09-19T14:29:47 Z Nurislam Gap (APIO16_gap) C++17
0 / 100
2000 ms 2448 KB
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#include "gap.h"
typedef long long ll;
vector<ll> a;
void solve1(ll l, ll r, int n){
	ll lf = 1, rf = 1;
	MinMax(l, r, &lf, &rf);
	cout << lf << ' ' << rf << '\n';
	if(lf == -1)return;
	a.pb(lf);
	if(lf != rf)a.pb(rf);
	if(lf == rf || a.size() >= n)return;
	l = lf + 1;
	r = rf - 1;
	ll len = sqrt(r-l)+1;
	ll last = l;
	while(last <= r){
		solve1(last, min(last + len, r), n);
		last += len + 1;
	}
}

long long findGap(int t, int n)
{
	
	solve1(0, 1e18, n);
	sort(all(a));
	ll ans = 1;
	for(int i = 1; i < a.size(); i++)
		ans = max(ans, a[i] - a[i-1]);
	
	return ans;
}




















Compilation message

gap.cpp: In function 'void solve1(ll, ll, int)':
gap.cpp:20:26: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |  if(lf == rf || a.size() >= n)return;
      |                 ~~~~~~~~~^~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:37:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for(int i = 1; i < a.size(); i++)
      |                 ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Expected EOLN
2 Execution timed out 3005 ms 692 KB Time limit exceeded
3 Execution timed out 2836 ms 708 KB Time limit exceeded (wall clock)
4 Execution timed out 3015 ms 956 KB Time limit exceeded
5 Incorrect 1 ms 344 KB Expected EOLN
6 Execution timed out 3008 ms 612 KB Time limit exceeded
7 Execution timed out 3001 ms 764 KB Time limit exceeded
8 Execution timed out 3033 ms 668 KB Time limit exceeded
9 Execution timed out 3059 ms 764 KB Time limit exceeded
10 Incorrect 1 ms 344 KB Expected EOLN
11 Execution timed out 3016 ms 748 KB Time limit exceeded
12 Execution timed out 3032 ms 500 KB Time limit exceeded
13 Execution timed out 3033 ms 688 KB Time limit exceeded
14 Execution timed out 3031 ms 688 KB Time limit exceeded
15 Incorrect 10 ms 344 KB Expected EOLN
16 Execution timed out 3014 ms 696 KB Time limit exceeded
17 Execution timed out 3062 ms 844 KB Time limit exceeded
18 Execution timed out 3008 ms 896 KB Time limit exceeded
19 Execution timed out 3028 ms 816 KB Time limit exceeded
20 Incorrect 9 ms 980 KB Expected EOLN
21 Execution timed out 3003 ms 1500 KB Time limit exceeded
22 Execution timed out 3038 ms 1416 KB Time limit exceeded
23 Execution timed out 3053 ms 1376 KB Time limit exceeded
24 Execution timed out 3045 ms 1524 KB Time limit exceeded
25 Incorrect 212 ms 2336 KB Expected EOLN
26 Execution timed out 3022 ms 1464 KB Time limit exceeded
27 Execution timed out 3021 ms 1512 KB Time limit exceeded
28 Execution timed out 3014 ms 1492 KB Time limit exceeded
29 Execution timed out 3008 ms 1288 KB Time limit exceeded
30 Incorrect 39 ms 2448 KB Expected EOLN
31 Execution timed out 3017 ms 684 KB Time limit exceeded
32 Execution timed out 3005 ms 776 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Expected EOLN
2 Execution timed out 2753 ms 676 KB Time limit exceeded (wall clock)
3 Execution timed out 2949 ms 824 KB Time limit exceeded (wall clock)
4 Execution timed out 2854 ms 676 KB Time limit exceeded (wall clock)
5 Incorrect 1 ms 344 KB Expected EOLN
6 Execution timed out 3055 ms 660 KB Time limit exceeded
7 Execution timed out 3017 ms 680 KB Time limit exceeded
8 Execution timed out 3040 ms 736 KB Time limit exceeded
9 Execution timed out 3051 ms 804 KB Time limit exceeded
10 Incorrect 1 ms 344 KB Expected EOLN
11 Execution timed out 3022 ms 656 KB Time limit exceeded
12 Execution timed out 3040 ms 700 KB Time limit exceeded
13 Execution timed out 3009 ms 956 KB Time limit exceeded
14 Execution timed out 3025 ms 600 KB Time limit exceeded
15 Incorrect 10 ms 344 KB Expected EOLN
16 Execution timed out 3026 ms 776 KB Time limit exceeded
17 Execution timed out 3005 ms 808 KB Time limit exceeded
18 Execution timed out 3024 ms 868 KB Time limit exceeded
19 Execution timed out 3025 ms 692 KB Time limit exceeded
20 Incorrect 13 ms 980 KB Expected EOLN
21 Execution timed out 3044 ms 1268 KB Time limit exceeded
22 Execution timed out 3018 ms 1480 KB Time limit exceeded
23 Execution timed out 3010 ms 1728 KB Time limit exceeded
24 Execution timed out 3015 ms 1496 KB Time limit exceeded
25 Incorrect 196 ms 2396 KB Expected EOLN
26 Execution timed out 3041 ms 1420 KB Time limit exceeded
27 Execution timed out 3044 ms 1412 KB Time limit exceeded
28 Execution timed out 3054 ms 1432 KB Time limit exceeded
29 Execution timed out 3007 ms 1504 KB Time limit exceeded
30 Incorrect 34 ms 2256 KB Expected EOLN
31 Execution timed out 3018 ms 688 KB Time limit exceeded
32 Execution timed out 3010 ms 688 KB Time limit exceeded (wall clock)