답안 #954742

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954742 2024-03-28T13:19:56 Z Itamar Gap (APIO16_gap) C++14
0 / 100
20 ms 5924 KB
#include "gap.h"
using namespace std;
#define ll long long
#include <vector>
#define vll vector<ll>
#include <algorithm>
long long findGap(int T, int N)
{
	if (T == 1) {
		ll a = -1, b = 1e18 + 1;
		vll v;
		for (int it = 0; it < (N + 1) / 2; it++) {
			ll* at = NULL, * bt = NULL;
			*at = 0, * bt = 0;
			MinMax(a + 1, b - 1, at, bt);
			a = *at, b = *bt;
			v.push_back(a); v.push_back(b);
		}
		sort(v.begin(), v.end());
		ll ans = 0;
		for (int i = 0; i < v.size() - 1; i++)ans = max(ans, v[i + 1] - v[i]);
		return ans;
	}
	else {
		ll* a = NULL, * b = NULL;
		*a = 0, * b = 0;
		MinMax(0, 1e18, a, b);
		vll v;
		ll d = (b - a + N - 2) / (N - 1);
		for (int i = *a; i < *b; i += d + 1) {
			ll* c = NULL, * k = NULL;
			*c = 0, * k = 0;
			MinMax(i, i + d, c, k);
			v.push_back(*c); v.push_back(*k);
		}
		sort(v.begin(), v.end());
		ll ans = d;
		for (int i = 0; i < v.size() - 1; i++) {
			if (v[i] > -1) {
				ans = max(ans, v[i + 1] - v[i]);
			}
		}
		return ans;
	}
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:21:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   for (int i = 0; i < v.size() - 1; i++)ans = max(ans, v[i + 1] - v[i]);
      |                   ~~^~~~~~~~~~~~~~
gap.cpp:38:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for (int i = 0; i < v.size() - 1; i++) {
      |                   ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Runtime error 2 ms 4440 KB Execution killed with signal 11
3 Runtime error 4 ms 4672 KB Execution killed with signal 11
4 Runtime error 4 ms 4516 KB Execution killed with signal 11
5 Runtime error 3 ms 4440 KB Execution killed with signal 11
6 Runtime error 3 ms 4440 KB Execution killed with signal 11
7 Runtime error 2 ms 4440 KB Execution killed with signal 11
8 Runtime error 2 ms 4440 KB Execution killed with signal 11
9 Runtime error 2 ms 4440 KB Execution killed with signal 11
10 Runtime error 2 ms 4440 KB Execution killed with signal 11
11 Runtime error 2 ms 4440 KB Execution killed with signal 11
12 Runtime error 3 ms 4696 KB Execution killed with signal 11
13 Runtime error 3 ms 4440 KB Execution killed with signal 11
14 Runtime error 3 ms 4696 KB Execution killed with signal 11
15 Runtime error 2 ms 4696 KB Execution killed with signal 11
16 Runtime error 6 ms 4884 KB Execution killed with signal 11
17 Runtime error 7 ms 5056 KB Execution killed with signal 11
18 Runtime error 6 ms 4876 KB Execution killed with signal 11
19 Runtime error 7 ms 4872 KB Execution killed with signal 11
20 Runtime error 4 ms 4864 KB Execution killed with signal 11
21 Runtime error 14 ms 5412 KB Execution killed with signal 11
22 Runtime error 14 ms 5416 KB Execution killed with signal 11
23 Runtime error 15 ms 5384 KB Execution killed with signal 11
24 Runtime error 14 ms 5420 KB Execution killed with signal 11
25 Runtime error 12 ms 5924 KB Execution killed with signal 11
26 Runtime error 14 ms 5416 KB Execution killed with signal 11
27 Runtime error 15 ms 5416 KB Execution killed with signal 11
28 Runtime error 15 ms 5392 KB Execution killed with signal 11
29 Runtime error 14 ms 5420 KB Execution killed with signal 11
30 Runtime error 10 ms 5332 KB Execution killed with signal 11
31 Runtime error 2 ms 4440 KB Execution killed with signal 11
32 Runtime error 2 ms 4440 KB Execution killed with signal 11
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 4440 KB Execution killed with signal 11
2 Runtime error 3 ms 4440 KB Execution killed with signal 11
3 Runtime error 2 ms 4440 KB Execution killed with signal 11
4 Runtime error 2 ms 4440 KB Execution killed with signal 11
5 Runtime error 3 ms 4440 KB Execution killed with signal 11
6 Runtime error 2 ms 4696 KB Execution killed with signal 11
7 Runtime error 2 ms 4440 KB Execution killed with signal 11
8 Runtime error 2 ms 4520 KB Execution killed with signal 11
9 Runtime error 2 ms 4696 KB Execution killed with signal 11
10 Runtime error 2 ms 4440 KB Execution killed with signal 11
11 Runtime error 3 ms 4696 KB Execution killed with signal 11
12 Runtime error 3 ms 4696 KB Execution killed with signal 11
13 Runtime error 3 ms 4696 KB Execution killed with signal 11
14 Runtime error 3 ms 4440 KB Execution killed with signal 11
15 Runtime error 2 ms 4440 KB Execution killed with signal 11
16 Runtime error 6 ms 4884 KB Execution killed with signal 11
17 Runtime error 5 ms 4884 KB Execution killed with signal 11
18 Runtime error 6 ms 4880 KB Execution killed with signal 11
19 Runtime error 6 ms 4856 KB Execution killed with signal 11
20 Runtime error 5 ms 4868 KB Execution killed with signal 11
21 Runtime error 20 ms 5424 KB Execution killed with signal 11
22 Runtime error 15 ms 5312 KB Execution killed with signal 11
23 Runtime error 15 ms 5612 KB Execution killed with signal 11
24 Runtime error 14 ms 5408 KB Execution killed with signal 11
25 Runtime error 12 ms 5408 KB Execution killed with signal 11
26 Runtime error 14 ms 5420 KB Execution killed with signal 11
27 Runtime error 15 ms 5412 KB Execution killed with signal 11
28 Runtime error 15 ms 5412 KB Execution killed with signal 11
29 Runtime error 16 ms 5588 KB Execution killed with signal 11
30 Runtime error 10 ms 5408 KB Execution killed with signal 11
31 Runtime error 3 ms 4440 KB Execution killed with signal 11
32 Runtime error 2 ms 4692 KB Execution killed with signal 11