답안 #975825

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975825 2024-05-05T23:58:27 Z Isam Gap (APIO16_gap) C++17
0 / 100
16 ms 1380 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
 
//#define eb emplace_back
//#define int long long

constexpr int sz = 1e5 + 5;

long long a[sz];

long long findGap(int T, int N){
	
	long long mn, mx;
	
	MinMax(0ll, (int)1E18, &mn, &mx);
	
	a[1] = mn, a[N] = mx;
	
	for(register int i = 2; i <= N/2 + (N & 1); ++i){
		
		long long l = a[i-1], r = a[N - i + 1];
		
		MinMax(l+1, r-1, &mn, &mx); // called by reference
	
		a[i] = mn, a[N - i + 1] = mx;
		
	}
	
	long long ans = -((long long)1E18 + 7);
	
	
	for(register int i = 2; i <= N; ++i){
		ans = min(ans, a[i] - a[i-1]);
	}
	
	
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:20:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |  for(register int i = 2; i <= N/2 + (N & 1); ++i){
      |                   ^
gap.cpp:33:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   33 |  for(register int i = 2; i <= N; ++i){
      |                   ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
5 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 340 KB Execution failed because the return code was nonzero
9 Runtime error 1 ms 596 KB Execution failed because the return code was nonzero
10 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
15 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
16 Runtime error 3 ms 640 KB Execution failed because the return code was nonzero
17 Runtime error 4 ms 644 KB Execution failed because the return code was nonzero
18 Runtime error 4 ms 648 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 656 KB Execution failed because the return code was nonzero
20 Runtime error 2 ms 620 KB Execution failed because the return code was nonzero
21 Runtime error 13 ms 1216 KB Execution failed because the return code was nonzero
22 Runtime error 13 ms 1160 KB Execution failed because the return code was nonzero
23 Runtime error 16 ms 1352 KB Execution failed because the return code was nonzero
24 Runtime error 13 ms 1216 KB Execution failed because the return code was nonzero
25 Runtime error 10 ms 1196 KB Execution failed because the return code was nonzero
26 Runtime error 13 ms 1080 KB Execution failed because the return code was nonzero
27 Runtime error 14 ms 1224 KB Execution failed because the return code was nonzero
28 Runtime error 13 ms 1200 KB Execution failed because the return code was nonzero
29 Runtime error 13 ms 1380 KB Execution failed because the return code was nonzero
30 Runtime error 8 ms 1360 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 340 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
7 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
9 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
10 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
13 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
14 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
15 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
16 Runtime error 3 ms 644 KB Execution failed because the return code was nonzero
17 Runtime error 4 ms 648 KB Execution failed because the return code was nonzero
18 Runtime error 4 ms 784 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 644 KB Execution failed because the return code was nonzero
20 Runtime error 2 ms 616 KB Execution failed because the return code was nonzero
21 Runtime error 13 ms 1080 KB Execution failed because the return code was nonzero
22 Runtime error 13 ms 1216 KB Execution failed because the return code was nonzero
23 Runtime error 13 ms 1188 KB Execution failed because the return code was nonzero
24 Runtime error 13 ms 1196 KB Execution failed because the return code was nonzero
25 Runtime error 10 ms 1364 KB Execution failed because the return code was nonzero
26 Runtime error 13 ms 1380 KB Execution failed because the return code was nonzero
27 Runtime error 13 ms 1216 KB Execution failed because the return code was nonzero
28 Runtime error 15 ms 1212 KB Execution failed because the return code was nonzero
29 Runtime error 15 ms 1376 KB Execution failed because the return code was nonzero
30 Runtime error 11 ms 1236 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
32 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero