답안 #1073489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1073489 2024-08-24T15:21:10 Z clementine Gap (APIO16_gap) C++17
0 / 100
23 ms 4696 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

long long findGap(int T, int N)
{
	ll l = 0;
	ll r = 10e8;
	vector<ll> left, right;
	int calls = (N + 1) / 2;
	ll mn, mx;
	for(int j = 1; j <= calls; j ++)
	{
		MinMax(l, r, &mn, &mx);
		if(mn != mx)
		{
			right.push_back(mx);
		}
		left.push_back(mn);
		l = mn + 1;
		r = mx - 1;
	}
	ll mxdif = 0;
	for(int i = 0; i <left.size() - 1; i ++)
	{
		mxdif = max(mxdif, left[i + 1] - left[i]);
	}
	for(int i = right.size() - 1; i >=1; i --)
	{
		mxdif = max(mxdif, right[i] - right[i-1]);
	}
	/*
	for(auto val:left)
	{
		cout<< val <<" " ;
	}
	cout << '\n';
	for(auto val:right)
	{
		cout<< val <<" " ;
	}*/
	int s= left.size();
	int u = right.size();
	mxdif=max(mxdif, right[u-1] - left[s-1]);
	return mxdif;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |  for(int i = 0; i <left.size() - 1; i ++)
      |                 ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
5 Correct 1 ms 2392 KB Output is correct
6 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
10 Incorrect 0 ms 2392 KB Output isn't correct
11 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
12 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
13 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
15 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
16 Runtime error 3 ms 2392 KB Execution failed because the return code was nonzero
17 Runtime error 3 ms 2392 KB Execution failed because the return code was nonzero
18 Runtime error 6 ms 2576 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 2508 KB Execution failed because the return code was nonzero
20 Incorrect 5 ms 2720 KB Output isn't correct
21 Runtime error 17 ms 2736 KB Execution failed because the return code was nonzero
22 Runtime error 13 ms 2648 KB Execution failed because the return code was nonzero
23 Runtime error 12 ms 2732 KB Execution failed because the return code was nonzero
24 Runtime error 23 ms 2648 KB Execution failed because the return code was nonzero
25 Runtime error 10 ms 2648 KB Execution failed because the return code was nonzero
26 Runtime error 12 ms 2652 KB Execution failed because the return code was nonzero
27 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
28 Runtime error 12 ms 2736 KB Execution failed because the return code was nonzero
29 Runtime error 22 ms 2648 KB Execution failed because the return code was nonzero
30 Incorrect 21 ms 3716 KB Output isn't correct
31 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 4696 KB Execution killed with signal 11
2 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
5 Partially correct 0 ms 2392 KB Partially correct
6 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
10 Incorrect 0 ms 2392 KB Output isn't correct
11 Runtime error 1 ms 2388 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 2496 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
16 Runtime error 3 ms 2392 KB Execution failed because the return code was nonzero
17 Runtime error 4 ms 2508 KB Execution failed because the return code was nonzero
18 Runtime error 3 ms 2392 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 2392 KB Execution failed because the return code was nonzero
20 Incorrect 6 ms 2908 KB Output isn't correct
21 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
22 Runtime error 12 ms 2716 KB Execution failed because the return code was nonzero
23 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
24 Runtime error 13 ms 2744 KB Execution failed because the return code was nonzero
25 Runtime error 10 ms 2648 KB Execution failed because the return code was nonzero
26 Runtime error 12 ms 2784 KB Execution failed because the return code was nonzero
27 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
28 Runtime error 13 ms 2648 KB Execution failed because the return code was nonzero
29 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
30 Incorrect 21 ms 3640 KB Expected int32, but "2500100000" found
31 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero