답안 #629638

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
629638 2022-08-14T20:16:24 Z Cyber_Wolf Gap (APIO16_gap) C++14
0 / 100
22 ms 1096 KB
//Contest: APIO 16 Problem 3
//Problem Name: Gap
 
 
#include <bits/stdc++.h>
#include "gap.h"
 
using namespace std;
 
 
long long findGap(int subtask, int n)
{
	vector<long long> v1, v2;
	long long first = 0, last = 1e18;
	for(int i = 0; i < n; i++)
	{
		long long mnm, mxm;
		MinMax(first, last, &mnm, &mxm);
		v1.push_back(mnm);
		if(first >= last)	break;
		if(mnm == mxm)	break;
		v2.push_back(mxm);
		last = mnm+1;
		first = mxm-1;
	}
	long long ans = 0;
	for(int i = 1; i < v1.size(); i++)	ans = max(ans, v1[i]-v1[i-1]);
	if(v2.size())
	{
		ans = max(ans, v2.front()-v1.back());
	}
	for(int i = 1; i < v2.size(); i++)
	{
		ans = max(ans, v2[i]-v2[i-1]);
	}
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for(int i = 1; i < v1.size(); i++) ans = max(ans, v1[i]-v1[i-1]);
      |                 ~~^~~~~~~~~~~
gap.cpp:32:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |  for(int i = 1; i < v2.size(); i++)
      |                 ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
10 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
13 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
15 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
16 Runtime error 4 ms 464 KB Execution failed because the return code was nonzero
17 Runtime error 4 ms 504 KB Execution failed because the return code was nonzero
18 Runtime error 5 ms 508 KB Execution failed because the return code was nonzero
19 Runtime error 7 ms 428 KB Execution failed because the return code was nonzero
20 Runtime error 3 ms 464 KB Execution failed because the return code was nonzero
21 Runtime error 16 ms 1084 KB Execution failed because the return code was nonzero
22 Runtime error 16 ms 1060 KB Execution failed because the return code was nonzero
23 Runtime error 15 ms 1056 KB Execution failed because the return code was nonzero
24 Runtime error 16 ms 1096 KB Execution failed because the return code was nonzero
25 Runtime error 13 ms 1044 KB Execution failed because the return code was nonzero
26 Runtime error 16 ms 976 KB Execution failed because the return code was nonzero
27 Runtime error 19 ms 1052 KB Execution failed because the return code was nonzero
28 Runtime error 22 ms 1044 KB Execution failed because the return code was nonzero
29 Runtime error 16 ms 968 KB Execution failed because the return code was nonzero
30 Runtime error 13 ms 1068 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
10 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
16 Runtime error 5 ms 464 KB Execution failed because the return code was nonzero
17 Runtime error 6 ms 508 KB Execution failed because the return code was nonzero
18 Runtime error 5 ms 424 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 484 KB Execution failed because the return code was nonzero
20 Runtime error 3 ms 464 KB Execution failed because the return code was nonzero
21 Runtime error 16 ms 1060 KB Execution failed because the return code was nonzero
22 Runtime error 15 ms 1056 KB Execution failed because the return code was nonzero
23 Runtime error 16 ms 1056 KB Execution failed because the return code was nonzero
24 Runtime error 16 ms 1052 KB Execution failed because the return code was nonzero
25 Runtime error 12 ms 1040 KB Execution failed because the return code was nonzero
26 Runtime error 17 ms 1040 KB Execution failed because the return code was nonzero
27 Runtime error 16 ms 1060 KB Execution failed because the return code was nonzero
28 Runtime error 22 ms 1016 KB Execution failed because the return code was nonzero
29 Runtime error 20 ms 972 KB Execution failed because the return code was nonzero
30 Runtime error 9 ms 1092 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero