답안 #22012

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22012 2017-04-28T20:19:37 Z Hiasat Gap (APIO16_gap) C++14
30 / 100
99 ms 8308 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std; 
typedef long long ll;
 
vector<ll> v;

long long findGap(int T, int N) {
	ll mx = 0;
	if(T == 2){
		ll lo,hi;
		MinMax(1, 1e18, &lo, &hi);
		v.push_back(lo);
		v.push_back(hi);
		ll big = hi;
		ll sure = (hi-lo)/(N-1);
		ll cur = lo;
		mx = sure;
		while(cur + sure < big){
			MinMax(cur, cur+sure, &lo, &hi);
			if(lo == -1){
				cur = cur + sure;
				continue;
			}
			v.push_back(lo);
			v.push_back(hi);
			cur = hi+1;
		}
	}else{
		ll lo = 1, hi = 1e18;
		int rem =(N+1)/2;
		while(rem--){
			ll a , b;
			MinMax(lo,hi,&a,&b);
			if(a == -1)
				break;
			v.push_back(a);
			v.push_back(b);
			lo = a+1;
			hi = b-1;
		}
	}
	sort(v.begin(),v.end());
	for (int i = 0; i+1 < v.size(); ++i){
		mx = max(mx,v[i+1]-v[i]);
	}
	return mx;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:44:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i+1 < v.size(); ++i){
                      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5148 KB Output is correct
2 Correct 0 ms 5148 KB Output is correct
3 Correct 0 ms 5148 KB Output is correct
4 Correct 0 ms 5148 KB Output is correct
5 Correct 0 ms 5148 KB Output is correct
6 Correct 0 ms 5148 KB Output is correct
7 Correct 0 ms 5148 KB Output is correct
8 Correct 0 ms 5148 KB Output is correct
9 Correct 0 ms 5148 KB Output is correct
10 Correct 0 ms 5148 KB Output is correct
11 Correct 0 ms 5148 KB Output is correct
12 Correct 0 ms 5148 KB Output is correct
13 Correct 0 ms 5148 KB Output is correct
14 Correct 0 ms 5148 KB Output is correct
15 Correct 0 ms 5148 KB Output is correct
16 Correct 13 ms 5620 KB Output is correct
17 Correct 13 ms 5620 KB Output is correct
18 Correct 9 ms 5620 KB Output is correct
19 Correct 13 ms 5620 KB Output is correct
20 Correct 9 ms 5620 KB Output is correct
21 Correct 46 ms 6772 KB Output is correct
22 Correct 56 ms 6772 KB Output is correct
23 Correct 59 ms 6772 KB Output is correct
24 Correct 56 ms 6772 KB Output is correct
25 Correct 56 ms 6772 KB Output is correct
26 Correct 59 ms 6772 KB Output is correct
27 Correct 63 ms 6772 KB Output is correct
28 Correct 56 ms 6772 KB Output is correct
29 Correct 49 ms 6772 KB Output is correct
30 Correct 43 ms 6772 KB Output is correct
31 Correct 0 ms 5148 KB Output is correct
32 Correct 0 ms 5148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5148 KB Output is correct
2 Partially correct 0 ms 5148 KB Partially correct
3 Partially correct 0 ms 5148 KB Partially correct
4 Partially correct 0 ms 5148 KB Partially correct
5 Correct 0 ms 5148 KB Output is correct
6 Partially correct 0 ms 5148 KB Partially correct
7 Partially correct 0 ms 5148 KB Partially correct
8 Partially correct 0 ms 5148 KB Partially correct
9 Partially correct 0 ms 5148 KB Partially correct
10 Incorrect 0 ms 5148 KB Output isn't correct
11 Partially correct 0 ms 5148 KB Partially correct
12 Partially correct 0 ms 5148 KB Partially correct
13 Partially correct 0 ms 5148 KB Partially correct
14 Partially correct 0 ms 5148 KB Partially correct
15 Correct 0 ms 5292 KB Output is correct
16 Partially correct 19 ms 6004 KB Partially correct
17 Partially correct 19 ms 6004 KB Partially correct
18 Partially correct 19 ms 6004 KB Partially correct
19 Partially correct 19 ms 6004 KB Partially correct
20 Partially correct 9 ms 5148 KB Partially correct
21 Partially correct 83 ms 8308 KB Partially correct
22 Partially correct 83 ms 8308 KB Partially correct
23 Partially correct 79 ms 8308 KB Partially correct
24 Partially correct 79 ms 8308 KB Partially correct
25 Correct 59 ms 8308 KB Output is correct
26 Partially correct 79 ms 8308 KB Partially correct
27 Partially correct 89 ms 8308 KB Partially correct
28 Partially correct 83 ms 8308 KB Partially correct
29 Partially correct 99 ms 8308 KB Partially correct
30 Partially correct 43 ms 5620 KB Partially correct
31 Partially correct 0 ms 5148 KB Partially correct
32 Correct 0 ms 5148 KB Output is correct