답안 #946409

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946409 2024-03-14T16:06:00 Z n3rm1n Gap (APIO16_gap) C++17
0 / 100
71 ms 4500 KB
/// gap
#include<bits/stdc++.h>
#include "gap.h"

using namespace std;

long long findGap(int T, int N)
{
	long long s = 0, t = (long long)1e18;
	long long mn, mx;
	vector < long long > fh, sh;
	while(mn < mx)
	{
	    cout << mn << " " << mx << endl;
	    MinMax(s, t, &mn, &mx);
	    if(mn == -1)break;
	    if(mn == mx)
        {
            fh.push_back(mn);
            break;
        }
        if(mn > mx)break;
        fh.push_back(mn);
        sh.push_back(mx);
        s = mn + 1;
        t = mx - 1;
	}
	reverse(sh.begin(), sh.end());
	long long ans = 0;
	for (int i = 1; i < fh.size(); ++ i)
        ans = max(ans, fh[i] - fh[i-1]);
    ans = max(ans, sh[0] - fh.back());
    for (int i = 1; i < sh.size(); ++ i)
        ans = max(ans, sh[i] - sh[i-1]);
    cout << ans << endl;
    return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:30:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  for (int i = 1; i < fh.size(); ++ i)
      |                  ~~^~~~~~~~~~~
gap.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for (int i = 1; i < sh.size(); ++ i)
      |                     ~~^~~~~~~~~~~
gap.cpp:12:11: warning: 'mn' is used uninitialized in this function [-Wuninitialized]
   12 |  while(mn < mx)
      |        ~~~^~~~
gap.cpp:12:11: warning: 'mx' is used uninitialized in this function [-Wuninitialized]
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Expected EOLN
2 Incorrect 1 ms 2392 KB Expected EOLN
3 Incorrect 1 ms 2392 KB Expected EOLN
4 Incorrect 0 ms 2392 KB Expected EOLN
5 Incorrect 1 ms 2392 KB Expected EOLN
6 Incorrect 1 ms 2392 KB Expected EOLN
7 Incorrect 0 ms 2392 KB Expected EOLN
8 Incorrect 1 ms 2392 KB Expected EOLN
9 Incorrect 1 ms 2392 KB Expected EOLN
10 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
11 Incorrect 1 ms 2392 KB Expected EOLN
12 Incorrect 1 ms 2392 KB Expected EOLN
13 Incorrect 2 ms 2564 KB Expected EOLN
14 Incorrect 1 ms 2392 KB Expected EOLN
15 Incorrect 1 ms 2392 KB Expected EOLN
16 Incorrect 12 ms 3472 KB Expected EOLN
17 Incorrect 15 ms 3092 KB Expected EOLN
18 Incorrect 16 ms 2828 KB Expected EOLN
19 Incorrect 13 ms 3220 KB Expected EOLN
20 Runtime error 12 ms 2812 KB Execution failed because the return code was nonzero
21 Incorrect 51 ms 3924 KB Expected EOLN
22 Incorrect 58 ms 4080 KB Expected EOLN
23 Incorrect 58 ms 4228 KB Expected EOLN
24 Incorrect 54 ms 4056 KB Expected EOLN
25 Incorrect 51 ms 4056 KB Expected EOLN
26 Incorrect 71 ms 4192 KB Expected EOLN
27 Incorrect 51 ms 4212 KB Expected EOLN
28 Incorrect 50 ms 4464 KB Expected EOLN
29 Incorrect 47 ms 4356 KB Expected EOLN
30 Runtime error 49 ms 3704 KB Execution failed because the return code was nonzero
31 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Expected EOLN
2 Incorrect 1 ms 2392 KB Expected EOLN
3 Incorrect 0 ms 2392 KB Expected EOLN
4 Incorrect 0 ms 2392 KB Expected EOLN
5 Incorrect 1 ms 2392 KB Expected EOLN
6 Incorrect 1 ms 2392 KB Expected EOLN
7 Incorrect 1 ms 2392 KB Expected EOLN
8 Incorrect 1 ms 2392 KB Expected EOLN
9 Incorrect 1 ms 2392 KB Expected EOLN
10 Runtime error 1 ms 2436 KB Execution failed because the return code was nonzero
11 Incorrect 1 ms 2392 KB Expected EOLN
12 Incorrect 1 ms 2392 KB Expected EOLN
13 Incorrect 1 ms 2392 KB Expected EOLN
14 Incorrect 2 ms 2548 KB Expected EOLN
15 Incorrect 1 ms 2392 KB Expected EOLN
16 Incorrect 13 ms 3188 KB Expected EOLN
17 Incorrect 12 ms 3216 KB Expected EOLN
18 Incorrect 12 ms 2968 KB Expected EOLN
19 Incorrect 12 ms 2972 KB Expected EOLN
20 Runtime error 12 ms 2824 KB Execution failed because the return code was nonzero
21 Incorrect 53 ms 3692 KB Expected EOLN
22 Incorrect 49 ms 4072 KB Expected EOLN
23 Incorrect 53 ms 4480 KB Expected EOLN
24 Incorrect 51 ms 4500 KB Expected EOLN
25 Incorrect 51 ms 3688 KB Expected EOLN
26 Incorrect 58 ms 3776 KB Expected EOLN
27 Incorrect 52 ms 4052 KB Expected EOLN
28 Incorrect 51 ms 4452 KB Expected EOLN
29 Incorrect 49 ms 4488 KB Expected EOLN
30 Runtime error 43 ms 3768 KB Execution failed because the return code was nonzero
31 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero