답안 #1083333

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1083333 2024-09-03T02:05:05 Z sonamoo Gap (APIO16_gap) C++14
70 / 100
48 ms 3268 KB
#include "gap.h"
#include <bits/stdc++.h>
#define pii pair<ll,ll>
#define ll long long

using namespace std;

pii query(ll s , ll e) {
    pii ret;
    MinMax(s , e , &ret.first , &ret.second);
    return ret;
}

vector<ll> v;

long long findGap(int T, int N)
{
    pii x = query(0 , 2e18);
    ll mi = x.first , ma = x.second;
    ll gap = (ma-mi+N-2)/(N-1);
    for (ll i = mi; i <= ma; i += gap+1) {
        pii ret=query(i , i+gap);
        if (ret.first!=-1) v.push_back(ret.first);
        if (ret.second!=-1) v.push_back(ret.second);
    }
    ll ans=0;
    for (int i = 0; i < v.size()-1; i++) ans = max(ans , v[i+1]-v[i]);

	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:27:23: 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 = 0; i < v.size()-1; i++) ans = max(ans , v[i+1]-v[i]);
      |                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Incorrect 0 ms 344 KB Output isn't correct
6 Incorrect 0 ms 344 KB Output isn't correct
7 Incorrect 1 ms 344 KB Output isn't correct
8 Incorrect 1 ms 344 KB Output isn't correct
9 Incorrect 0 ms 344 KB Output isn't correct
10 Incorrect 0 ms 344 KB Output isn't correct
11 Incorrect 1 ms 344 KB Output isn't correct
12 Incorrect 1 ms 344 KB Output isn't correct
13 Incorrect 1 ms 340 KB Output isn't correct
14 Incorrect 1 ms 344 KB Output isn't correct
15 Incorrect 1 ms 344 KB Output isn't correct
16 Incorrect 9 ms 948 KB Output isn't correct
17 Incorrect 9 ms 980 KB Output isn't correct
18 Incorrect 9 ms 980 KB Output isn't correct
19 Incorrect 11 ms 980 KB Output isn't correct
20 Incorrect 5 ms 600 KB Output isn't correct
21 Incorrect 39 ms 2356 KB Output isn't correct
22 Incorrect 35 ms 2184 KB Output isn't correct
23 Incorrect 36 ms 2248 KB Output isn't correct
24 Incorrect 37 ms 2256 KB Output isn't correct
25 Incorrect 37 ms 3172 KB Output isn't correct
26 Incorrect 38 ms 2256 KB Output isn't correct
27 Incorrect 38 ms 2248 KB Output isn't correct
28 Incorrect 38 ms 2380 KB Output isn't correct
29 Incorrect 48 ms 2256 KB Output isn't correct
30 Incorrect 21 ms 1368 KB Output isn't correct
31 Incorrect 1 ms 344 KB Output isn't correct
32 Incorrect 0 ms 344 KB Output isn't correct
# 결과 실행 시간 메모리 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 0 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 0 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 12 ms 1032 KB Output is correct
17 Correct 12 ms 980 KB Output is correct
18 Correct 9 ms 980 KB Output is correct
19 Correct 10 ms 1044 KB Output is correct
20 Correct 4 ms 600 KB Output is correct
21 Correct 40 ms 2308 KB Output is correct
22 Correct 35 ms 2256 KB Output is correct
23 Correct 47 ms 2256 KB Output is correct
24 Correct 36 ms 2248 KB Output is correct
25 Correct 43 ms 3268 KB Output is correct
26 Correct 36 ms 2256 KB Output is correct
27 Correct 36 ms 2256 KB Output is correct
28 Correct 37 ms 2248 KB Output is correct
29 Correct 36 ms 2248 KB Output is correct
30 Correct 27 ms 1624 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct