답안 #992083

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
992083 2024-06-03T21:10:26 Z MladenP Gap (APIO16_gap) C++17
0 / 100
2000 ms 13444 KB
#include "gap.h"
#include <algorithm>
#include <iostream> 

using namespace std;

const long long MIN = 0;
const long long MAX = 1'000'000'000'000'000'000;
long long findGap(int T, int N)
{
	if (T == 1) {
		long long mn, mx; 
		long long prev_mn, prev_mx;
		long long sol = 0;
		MinMax(MIN, MAX, &prev_mn, &prev_mx);
		while (prev_mn+1 <= prev_mx-1) {
			MinMax(prev_mn+1, prev_mx-1, &mn, &mx);
			if (mn != -1) {
				sol = max(sol, prev_mx-mx);
				sol = max(sol, mn-prev_mn);
			} else {
				sol = max(sol, prev_mx-prev_mn);
				break;
			}
		}
		return sol;
	} else if (T == 2) {
		long long mn, mx;
		MinMax(MIN, MAX, &mn, &mx);
		long long diff = (mx-mn+1 + N-2)/(N-1), sol = 0, prev_mx = MAX, st = mn;
		while (st <= mx) {
			long long en = min(MAX, st+diff-1), cur_mn, cur_mx;
			MinMax(st,  en, &cur_mn, &cur_mx);
			cerr << st << ' ' << en << ' ' << cur_mn << ' ' << cur_mx << endl;
			if (cur_mn != -1) {
				sol = max(sol, cur_mn - prev_mx);
				prev_mx = cur_mx;
			}
			st += diff;
			cerr << "ST " << st << ' ' << mx << endl;
		}
		return sol;
	}
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Execution timed out 3047 ms 2392 KB Time limit exceeded
3 Execution timed out 3083 ms 2392 KB Time limit exceeded
4 Execution timed out 3059 ms 2392 KB Time limit exceeded
5 Execution timed out 3045 ms 2392 KB Time limit exceeded
6 Execution timed out 3053 ms 2644 KB Time limit exceeded
7 Execution timed out 3057 ms 2396 KB Time limit exceeded
8 Execution timed out 3048 ms 2392 KB Time limit exceeded
9 Execution timed out 3042 ms 2392 KB Time limit exceeded
10 Execution timed out 3038 ms 2392 KB Time limit exceeded
11 Execution timed out 3044 ms 2392 KB Time limit exceeded
12 Execution timed out 3027 ms 2392 KB Time limit exceeded
13 Execution timed out 3008 ms 2392 KB Time limit exceeded
14 Execution timed out 3099 ms 2392 KB Time limit exceeded
15 Execution timed out 3036 ms 2392 KB Time limit exceeded
16 Execution timed out 3071 ms 2392 KB Time limit exceeded
17 Execution timed out 3062 ms 2392 KB Time limit exceeded
18 Execution timed out 3045 ms 2392 KB Time limit exceeded
19 Execution timed out 3033 ms 2392 KB Time limit exceeded
20 Execution timed out 3069 ms 2392 KB Time limit exceeded
21 Execution timed out 3067 ms 2648 KB Time limit exceeded
22 Execution timed out 3065 ms 2648 KB Time limit exceeded
23 Execution timed out 3067 ms 2648 KB Time limit exceeded
24 Execution timed out 3054 ms 2648 KB Time limit exceeded
25 Execution timed out 3073 ms 2648 KB Time limit exceeded
26 Execution timed out 3015 ms 2648 KB Time limit exceeded
27 Execution timed out 3014 ms 2648 KB Time limit exceeded
28 Execution timed out 3065 ms 2648 KB Time limit exceeded
29 Execution timed out 3043 ms 2648 KB Time limit exceeded
30 Execution timed out 3069 ms 2648 KB Time limit exceeded
31 Execution timed out 3047 ms 2392 KB Time limit exceeded
32 Execution timed out 3050 ms 2392 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2392 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 2 ms 2392 KB Output is correct
7 Correct 2 ms 2392 KB Output is correct
8 Correct 2 ms 2392 KB Output is correct
9 Correct 2 ms 2392 KB Output is correct
10 Correct 2 ms 2392 KB Output is correct
11 Correct 20 ms 2656 KB Output is correct
12 Correct 20 ms 2648 KB Output is correct
13 Correct 20 ms 2612 KB Output is correct
14 Correct 20 ms 2648 KB Output is correct
15 Correct 20 ms 2392 KB Output is correct
16 Correct 337 ms 4960 KB Output is correct
17 Correct 333 ms 5200 KB Output is correct
18 Correct 321 ms 4944 KB Output is correct
19 Correct 325 ms 4944 KB Output is correct
20 Correct 312 ms 3372 KB Output is correct
21 Correct 1313 ms 13376 KB Output is correct
22 Correct 1318 ms 13136 KB Output is correct
23 Correct 1297 ms 13136 KB Output is correct
24 Correct 1288 ms 13136 KB Output is correct
25 Correct 1255 ms 10576 KB Output is correct
26 Correct 1256 ms 13252 KB Output is correct
27 Correct 1249 ms 13252 KB Output is correct
28 Correct 1231 ms 13444 KB Output is correct
29 Correct 1285 ms 13312 KB Output is correct
30 Correct 1171 ms 6400 KB Output is correct
31 Correct 2 ms 2392 KB Output is correct
32 Correct 2 ms 2392 KB Output is correct