#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
stack<long long> st;
vector<long long> arr;
long long findGap(int T, int N)
{
long long ans=LLONG_MIN;
long long l=-1,r=1e18+1,mn,mx;
while(l+1<=r-1){
MinMax(l+1,r-1,&mn,&mx);
if(mn==-1) break;
arr.push_back(mn);
if(mn!=mx) st.push(mx);
l=mn+1,r=mn-1;
}
while(!st.empty()) arr.push_back(st.top()),st.pop();
for(int i=0;i<N-1;i++){
ans=max(ans,arr[i+1]-arr[i]);
}
/*for(int i=0;i<N;i++) cout<<arr[i] <<" ";
cout<<"\n\n";*/
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
0 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 |
0 ms |
344 KB |
Output isn't correct |
8 |
Incorrect |
0 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 |
340 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
448 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
16 |
Runtime error |
4 ms |
856 KB |
Execution killed with signal 11 |
17 |
Runtime error |
4 ms |
856 KB |
Execution killed with signal 11 |
18 |
Runtime error |
4 ms |
876 KB |
Execution killed with signal 11 |
19 |
Runtime error |
7 ms |
856 KB |
Execution killed with signal 11 |
20 |
Runtime error |
2 ms |
856 KB |
Execution killed with signal 11 |
21 |
Runtime error |
22 ms |
2040 KB |
Execution killed with signal 11 |
22 |
Runtime error |
22 ms |
2092 KB |
Execution killed with signal 11 |
23 |
Runtime error |
14 ms |
2136 KB |
Execution killed with signal 11 |
24 |
Runtime error |
13 ms |
2136 KB |
Execution killed with signal 11 |
25 |
Runtime error |
11 ms |
1972 KB |
Execution killed with signal 11 |
26 |
Runtime error |
24 ms |
2136 KB |
Execution killed with signal 11 |
27 |
Runtime error |
13 ms |
2132 KB |
Execution killed with signal 11 |
28 |
Runtime error |
13 ms |
2136 KB |
Execution killed with signal 11 |
29 |
Runtime error |
14 ms |
2136 KB |
Execution killed with signal 11 |
30 |
Runtime error |
10 ms |
1964 KB |
Execution killed with signal 11 |
31 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
0 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 |
0 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 |
0 ms |
344 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
16 |
Runtime error |
4 ms |
856 KB |
Execution killed with signal 11 |
17 |
Runtime error |
7 ms |
1108 KB |
Execution killed with signal 11 |
18 |
Runtime error |
4 ms |
856 KB |
Execution killed with signal 11 |
19 |
Runtime error |
4 ms |
948 KB |
Execution killed with signal 11 |
20 |
Runtime error |
5 ms |
856 KB |
Execution killed with signal 11 |
21 |
Runtime error |
14 ms |
2032 KB |
Execution killed with signal 11 |
22 |
Runtime error |
17 ms |
2136 KB |
Execution killed with signal 11 |
23 |
Runtime error |
13 ms |
1968 KB |
Execution killed with signal 11 |
24 |
Runtime error |
21 ms |
2136 KB |
Execution killed with signal 11 |
25 |
Runtime error |
10 ms |
2136 KB |
Execution killed with signal 11 |
26 |
Runtime error |
24 ms |
2128 KB |
Execution killed with signal 11 |
27 |
Runtime error |
25 ms |
2136 KB |
Execution killed with signal 11 |
28 |
Runtime error |
24 ms |
2136 KB |
Execution killed with signal 11 |
29 |
Runtime error |
13 ms |
2136 KB |
Execution killed with signal 11 |
30 |
Runtime error |
8 ms |
2136 KB |
Execution killed with signal 11 |
31 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |