# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
852059 |
2023-09-21T07:43:33 Z |
8pete8 |
Gap (APIO16_gap) |
C++17 |
|
24 ms |
2864 KB |
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include<bitset>
#include "gap.h"
using namespace std;
#define ll long long
#define f first
#define endl "\n"
//#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define ll long long
const int mxn=1e5,mod=1000000007,lg=20,root=1000,inf=1e18;
ll findGap(int T,int N){
ll mn,mx;
MinMax(1,1e18,&mn,&mx);
if(N==2)return mx-mn;
ll ans=0;
if(T==1){
int lmn=mn,lmx=mx;
while(mn<mx){
MinMax(lmn+1,lmx-1,&mn,&mx);
ans=max({ans,mn-lmn,lmx-mx});
lmn=mn;
lmx=mx;
if(mn==-1)break;
}
return ans;
}
ans=((mx-mn-1)+(N-2))/(N-2);//min max gap
int add=0,cur=mn;
for(int i=0;i<N;i++){
MinMax(cur+1,cur+ans,&mn,&mx);
if(mn==-1)add+=(ans);
else cur=mx,ans=max(ans,add+(mn-cur));
}
return ans;
}
Compilation message
gap.cpp:30:54: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
30 | const int mxn=1e5,mod=1000000007,lg=20,root=1000,inf=1e18;
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
3 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
4 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
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 |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
8 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
9 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
0 ms |
2392 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
1 ms |
2392 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 |
Incorrect |
1 ms |
2644 KB |
Output isn't correct |
15 |
Runtime error |
1 ms |
2392 KB |
Execution failed because the return code was nonzero |
16 |
Incorrect |
3 ms |
2584 KB |
Output isn't correct |
17 |
Runtime error |
4 ms |
2588 KB |
Execution failed because the return code was nonzero |
18 |
Incorrect |
3 ms |
2588 KB |
Output isn't correct |
19 |
Runtime error |
3 ms |
2584 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
6 ms |
2568 KB |
Execution failed because the return code was nonzero |
21 |
Runtime error |
12 ms |
2852 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
12 ms |
2856 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
15 ms |
2720 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
13 ms |
2864 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
9 ms |
2848 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
12 ms |
2860 KB |
Execution failed because the return code was nonzero |
27 |
Incorrect |
12 ms |
2852 KB |
Output isn't correct |
28 |
Incorrect |
12 ms |
2860 KB |
Output isn't correct |
29 |
Incorrect |
13 ms |
2856 KB |
Output isn't correct |
30 |
Runtime error |
23 ms |
2864 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
16 |
Incorrect |
6 ms |
2588 KB |
Output isn't correct |
17 |
Incorrect |
6 ms |
2392 KB |
Output isn't correct |
18 |
Incorrect |
6 ms |
2580 KB |
Output isn't correct |
19 |
Incorrect |
7 ms |
2568 KB |
Output isn't correct |
20 |
Incorrect |
5 ms |
2576 KB |
Output isn't correct |
21 |
Incorrect |
23 ms |
2856 KB |
Output isn't correct |
22 |
Incorrect |
23 ms |
2856 KB |
Output isn't correct |
23 |
Incorrect |
23 ms |
2852 KB |
Output isn't correct |
24 |
Incorrect |
23 ms |
2860 KB |
Output isn't correct |
25 |
Incorrect |
21 ms |
2864 KB |
Output isn't correct |
26 |
Incorrect |
23 ms |
2856 KB |
Output isn't correct |
27 |
Incorrect |
23 ms |
2860 KB |
Output isn't correct |
28 |
Incorrect |
24 ms |
2860 KB |
Output isn't correct |
29 |
Incorrect |
23 ms |
2856 KB |
Output isn't correct |
30 |
Incorrect |
21 ms |
2864 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
32 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |