#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
#include "gap.h"
long long findGap(int T,int N) {
int i;
LLI l,r,mn,mx;
MinMax(0,(LLI) (1e18+EPS),&l,&r);
if (N == 2) return r-l;
LLI a = (r-l-1)/N,b = (r-l-1) % N;
vlli v;
v.pb(l);
for (i = 0; i < N; i++) {
if (i < b) MinMax(l+i*a+1,l+(i+1)*a+1,&mn,&mx);
else MinMax(l+i*a+2,l+(i+1)*a+1,&mn,&mx);
if (mn != -1) v.pb(mn);
if (mn != mx) v.pb(mx);
}
v.pb(r);
LLI ans = 0;
for (i = 1; i < v.size(); i++) ans = max(ans,v[i]-v[i-1]);
return ans;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:75:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 1; i < v.size(); i++) ans = max(ans,v[i]-v[i-1]);
~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
428 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
508 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
644 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
644 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
644 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
644 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
644 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
656 KB |
Output isn't correct |
11 |
Incorrect |
3 ms |
664 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
688 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
748 KB |
Output isn't correct |
14 |
Incorrect |
4 ms |
792 KB |
Output isn't correct |
15 |
Incorrect |
3 ms |
836 KB |
Output isn't correct |
16 |
Incorrect |
20 ms |
1876 KB |
Output isn't correct |
17 |
Incorrect |
22 ms |
2340 KB |
Output isn't correct |
18 |
Incorrect |
19 ms |
2804 KB |
Output isn't correct |
19 |
Incorrect |
20 ms |
3268 KB |
Output isn't correct |
20 |
Incorrect |
10 ms |
3268 KB |
Output isn't correct |
21 |
Incorrect |
74 ms |
6712 KB |
Output isn't correct |
22 |
Incorrect |
74 ms |
8428 KB |
Output isn't correct |
23 |
Incorrect |
74 ms |
10360 KB |
Output isn't correct |
24 |
Incorrect |
74 ms |
12112 KB |
Output isn't correct |
25 |
Incorrect |
69 ms |
13384 KB |
Output isn't correct |
26 |
Incorrect |
76 ms |
15240 KB |
Output isn't correct |
27 |
Incorrect |
77 ms |
17164 KB |
Output isn't correct |
28 |
Incorrect |
75 ms |
19004 KB |
Output isn't correct |
29 |
Incorrect |
74 ms |
20724 KB |
Output isn't correct |
30 |
Incorrect |
36 ms |
20724 KB |
Output isn't correct |
31 |
Incorrect |
2 ms |
20724 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
20724 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
20724 KB |
Output is correct |
2 |
Correct |
2 ms |
20724 KB |
Output is correct |
3 |
Correct |
2 ms |
20724 KB |
Output is correct |
4 |
Correct |
2 ms |
20724 KB |
Output is correct |
5 |
Correct |
2 ms |
20724 KB |
Output is correct |
6 |
Correct |
2 ms |
20724 KB |
Output is correct |
7 |
Correct |
2 ms |
20724 KB |
Output is correct |
8 |
Correct |
2 ms |
20724 KB |
Output is correct |
9 |
Correct |
2 ms |
20724 KB |
Output is correct |
10 |
Incorrect |
2 ms |
20724 KB |
Output isn't correct |
11 |
Correct |
3 ms |
20724 KB |
Output is correct |
12 |
Correct |
3 ms |
20724 KB |
Output is correct |
13 |
Correct |
3 ms |
20724 KB |
Output is correct |
14 |
Correct |
3 ms |
20724 KB |
Output is correct |
15 |
Correct |
3 ms |
20724 KB |
Output is correct |
16 |
Correct |
19 ms |
20792 KB |
Output is correct |
17 |
Correct |
20 ms |
21232 KB |
Output is correct |
18 |
Correct |
19 ms |
21700 KB |
Output is correct |
19 |
Correct |
19 ms |
22164 KB |
Output is correct |
20 |
Incorrect |
11 ms |
22164 KB |
Output isn't correct |
21 |
Correct |
79 ms |
25612 KB |
Output is correct |
22 |
Correct |
77 ms |
27348 KB |
Output is correct |
23 |
Correct |
76 ms |
29196 KB |
Output is correct |
24 |
Correct |
76 ms |
31056 KB |
Output is correct |
25 |
Correct |
72 ms |
32216 KB |
Output is correct |
26 |
Correct |
75 ms |
34076 KB |
Output is correct |
27 |
Correct |
75 ms |
36060 KB |
Output is correct |
28 |
Correct |
74 ms |
37824 KB |
Output is correct |
29 |
Correct |
79 ms |
39668 KB |
Output is correct |
30 |
Incorrect |
37 ms |
39668 KB |
Output isn't correct |
31 |
Correct |
2 ms |
39668 KB |
Output is correct |
32 |
Correct |
2 ms |
39668 KB |
Output is correct |