답안 #721418

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
721418 2023-04-10T20:49:25 Z FatihSolak Gap (APIO16_gap) C++17
100 / 100
51 ms 1872 KB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
const long long INF = 1e18;
long long findGap(int t, int n)
{
	if(t == 1){
		int cnt = 0;
		vector<long long> v(n);
		long long l = -1,r=INF+1;
		while(cnt <= n-1-cnt){
			MinMax(l+1,r-1,&v[cnt],&v[n-1-cnt]);
			l = v[cnt];
			r = v[n-1-cnt];
			cnt++;
		}
		long long ans = 0;
		for(int i = 1;i<n;i++){
			ans = max(ans,v[i]-v[i-1]);
		}
		return ans;
	}
	if(t == 2){
		long long x,y;
		MinMax(0,INF,&x,&y);
		long long ans = (y-x)/(n-1);
		long long num = x;
		long long last = x;
		while(num != y){
			long long tmp1,tmp2;
			MinMax(num+1,num+ans,&tmp1,&tmp2);
			if(tmp1 == -1){
				num += ans;
			}
			else{
				ans = max(ans,tmp1 - last);
				num = tmp2;
				last = tmp2;
			}
		}
		return ans;
	}
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:43:1: warning: control reaches end of non-void function [-Wreturn-type]
   43 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 276 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 9 ms 720 KB Output is correct
17 Correct 10 ms 720 KB Output is correct
18 Correct 11 ms 592 KB Output is correct
19 Correct 9 ms 720 KB Output is correct
20 Correct 7 ms 720 KB Output is correct
21 Correct 37 ms 1816 KB Output is correct
22 Correct 34 ms 1788 KB Output is correct
23 Correct 43 ms 1824 KB Output is correct
24 Correct 46 ms 1824 KB Output is correct
25 Correct 32 ms 1824 KB Output is correct
26 Correct 43 ms 1772 KB Output is correct
27 Correct 36 ms 1780 KB Output is correct
28 Correct 51 ms 1824 KB Output is correct
29 Correct 38 ms 1756 KB Output is correct
30 Correct 29 ms 1872 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 2 ms 336 KB Output is correct
16 Correct 9 ms 520 KB Output is correct
17 Correct 6 ms 464 KB Output is correct
18 Correct 7 ms 464 KB Output is correct
19 Correct 6 ms 464 KB Output is correct
20 Correct 5 ms 464 KB Output is correct
21 Correct 24 ms 1088 KB Output is correct
22 Correct 31 ms 1172 KB Output is correct
23 Correct 22 ms 1104 KB Output is correct
24 Correct 26 ms 1056 KB Output is correct
25 Correct 44 ms 1084 KB Output is correct
26 Correct 24 ms 996 KB Output is correct
27 Correct 24 ms 1080 KB Output is correct
28 Correct 24 ms 1060 KB Output is correct
29 Correct 23 ms 968 KB Output is correct
30 Correct 18 ms 1068 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct