답안 #1085042

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1085042 2024-09-07T11:51:56 Z Timosh Gap (APIO16_gap) C++17
30 / 100
63 ms 5848 KB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;

long long mn = 0, mx = 0;
set<long long> st;
void gen(long long l, long long r)
{
	MinMax(l, r, &mn, &mx);
	if (mn == -1)
		return;
	st.insert(mn);
	st.insert(mx);
	if (mn == mx)
		return;
	l = mn + 1, r = mx - 1;
	gen(l, (l + r) / 2);
	gen((l + r) / 2 + 1, r);
}

long long findGap(int T, int N)
{
	long long ans = 1;
	if (T == 2)
	{
		gen(0, 1e18);
	}
	else
	{
		long long l = 0, r = 1e18;
		while (1)
		{
			MinMax(l, r, &mn, &mx);
			if (mn == -1)
				break;
			st.insert(mn);
			st.insert(mx);
			l = mn + 1, r = mx - 1;
			if (mn == mx || st.size() >= N)
				break;
		}
	}
	long long last = *st.begin();
	for (auto &i : st)
		ans = max(ans, i - last), last = i;
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:39:30: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |    if (mn == mx || st.size() >= N)
      |                    ~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 9 ms 1660 KB Output is correct
17 Correct 9 ms 1624 KB Output is correct
18 Correct 10 ms 1624 KB Output is correct
19 Correct 9 ms 1624 KB Output is correct
20 Correct 8 ms 1624 KB Output is correct
21 Correct 42 ms 5748 KB Output is correct
22 Correct 43 ms 5780 KB Output is correct
23 Correct 43 ms 5800 KB Output is correct
24 Correct 47 ms 5768 KB Output is correct
25 Correct 47 ms 5708 KB Output is correct
26 Correct 50 ms 5708 KB Output is correct
27 Correct 40 ms 5716 KB Output is correct
28 Correct 40 ms 5712 KB Output is correct
29 Correct 41 ms 5712 KB Output is correct
30 Correct 42 ms 5712 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Partially correct 0 ms 344 KB Partially correct
3 Partially correct 0 ms 344 KB Partially correct
4 Partially correct 0 ms 456 KB Partially correct
5 Partially correct 0 ms 344 KB Partially correct
6 Partially correct 0 ms 344 KB Partially correct
7 Partially correct 0 ms 344 KB Partially correct
8 Partially correct 0 ms 344 KB Partially correct
9 Partially correct 0 ms 596 KB Partially correct
10 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
11 Partially correct 1 ms 344 KB Partially correct
12 Partially correct 1 ms 504 KB Partially correct
13 Partially correct 1 ms 344 KB Partially correct
14 Partially correct 1 ms 344 KB Partially correct
15 Partially correct 1 ms 476 KB Partially correct
16 Partially correct 12 ms 1624 KB Partially correct
17 Partially correct 15 ms 1620 KB Partially correct
18 Partially correct 14 ms 1624 KB Partially correct
19 Partially correct 14 ms 1624 KB Partially correct
20 Runtime error 3 ms 600 KB Execution failed because the return code was nonzero
21 Partially correct 54 ms 5776 KB Partially correct
22 Partially correct 55 ms 5752 KB Partially correct
23 Partially correct 63 ms 5716 KB Partially correct
24 Partially correct 54 ms 5712 KB Partially correct
25 Partially correct 45 ms 5712 KB Partially correct
26 Partially correct 53 ms 5712 KB Partially correct
27 Partially correct 59 ms 5848 KB Partially correct
28 Partially correct 49 ms 5712 KB Partially correct
29 Partially correct 56 ms 5848 KB Partially correct
30 Runtime error 7 ms 1112 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