# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
560973 |
2022-05-12T06:29:21 Z |
Huy |
Gap (APIO16_gap) |
C++17 |
|
63 ms |
4992 KB |
#include "gap.h"
#include<bits/stdc++.h>
//#define int long long
#define pii pair<int,int>
#define fi first
#define se second
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")*/
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ldb = long double;
const int N = (int)5e5;
const int maxN = (int)5e5 + 5;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infty = 1e18;
const ll logn = 18;
const int base = 311;
const int Block_size = 500;
const int ep = 'a';
int cu[] = {0,0,1,-1};
int cv[] = {-1,1,0,0};
int du[] = {-1,-1,+1,1};
int dv[] = {-1,+1,-1,1};
int cled[] = {6,2,5,5,4,5,6,3,7,6};
void InputFile()
{
freopen(".inp","r",stdin);
freopen(".out","w",stdout);
//freopen("test.out","r",stdin);
}
void FastInput()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
/*void MinMax(int L,int R,int x,int y)
{
return;
}*/
ll findGap(int T, int n)
{
if(T == 1)
{
ll a[maxN];
ll L = 0;
ll R = infty;
for(int i = 1;i <= (n + 1)/2;i++)
{
MinMax(L,R,&a[i],&a[n+1-i]);
L = a[i+1];
R = a[n+i-1]-1;
}
ll res = 0;
for(int i = 2;i <= n;i++)
{
res = max(res,a[i]-a[i-1]);
}
return res;
}
ll res = 0;
ll mini,maxi;
MinMax(0,infty, &mini, &maxi);
ll pre = mini;
ll h = (maxi - mini + n - 2) / (n - 1);
ll now = mini + 1;
while(true)
{
ll p, q;
MinMax(now, now + h - 1, &p, &q);
res = max(res, p - pre);
pre = max(pre, q);
now += h;
if(q == maxi) break;
}
return res;
}
/*void Read()
{
}
void Solve()
{
}
void Debug()
{
//Main_sub();
//Naive();
}
signed main()
{
FastInput();
//InputFile();
//int sub_type;
//cin >> sub_type;
//Sieve();
int test;
//cin >> test;
test = 1;
while(test--)
//for(int prc = 1; prc <= test; prc++)
{
Read();
Solve();
//Debug();
}
}*/
Compilation message
gap.cpp: In function 'void InputFile()':
gap.cpp:36:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
36 | freopen(".inp","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~
gap.cpp:37:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
37 | freopen(".out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4176 KB |
Output is correct |
2 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
3 ms |
4176 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
3 ms |
4176 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
3 ms |
4176 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
2 ms |
4228 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
7 ms |
4416 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
10 ms |
4320 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
7 ms |
4400 KB |
Execution failed because the return code was nonzero |
19 |
Runtime error |
6 ms |
4304 KB |
Execution failed because the return code was nonzero |
20 |
Runtime error |
5 ms |
4304 KB |
Execution failed because the return code was nonzero |
21 |
Runtime error |
21 ms |
4936 KB |
Execution failed because the return code was nonzero |
22 |
Runtime error |
22 ms |
4900 KB |
Execution failed because the return code was nonzero |
23 |
Runtime error |
20 ms |
4900 KB |
Execution failed because the return code was nonzero |
24 |
Runtime error |
22 ms |
4880 KB |
Execution failed because the return code was nonzero |
25 |
Runtime error |
16 ms |
4876 KB |
Execution failed because the return code was nonzero |
26 |
Runtime error |
22 ms |
4952 KB |
Execution failed because the return code was nonzero |
27 |
Runtime error |
22 ms |
4928 KB |
Execution failed because the return code was nonzero |
28 |
Runtime error |
21 ms |
4948 KB |
Execution failed because the return code was nonzero |
29 |
Runtime error |
21 ms |
4936 KB |
Execution failed because the return code was nonzero |
30 |
Runtime error |
15 ms |
4956 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
2 ms |
4176 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
3 ms |
4176 KB |
Execution failed because the return code was nonzero |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4176 KB |
Output is correct |
2 |
Correct |
3 ms |
4176 KB |
Output is correct |
3 |
Correct |
2 ms |
4176 KB |
Output is correct |
4 |
Correct |
2 ms |
4176 KB |
Output is correct |
5 |
Correct |
2 ms |
4176 KB |
Output is correct |
6 |
Correct |
3 ms |
4176 KB |
Output is correct |
7 |
Correct |
2 ms |
4176 KB |
Output is correct |
8 |
Correct |
2 ms |
4176 KB |
Output is correct |
9 |
Correct |
2 ms |
4176 KB |
Output is correct |
10 |
Correct |
2 ms |
4176 KB |
Output is correct |
11 |
Correct |
3 ms |
4304 KB |
Output is correct |
12 |
Correct |
3 ms |
4176 KB |
Output is correct |
13 |
Correct |
3 ms |
4176 KB |
Output is correct |
14 |
Correct |
3 ms |
4176 KB |
Output is correct |
15 |
Correct |
3 ms |
4240 KB |
Output is correct |
16 |
Correct |
16 ms |
4304 KB |
Output is correct |
17 |
Correct |
14 ms |
4340 KB |
Output is correct |
18 |
Correct |
17 ms |
4384 KB |
Output is correct |
19 |
Correct |
14 ms |
4344 KB |
Output is correct |
20 |
Correct |
9 ms |
4420 KB |
Output is correct |
21 |
Correct |
58 ms |
4988 KB |
Output is correct |
22 |
Correct |
54 ms |
4904 KB |
Output is correct |
23 |
Correct |
58 ms |
4992 KB |
Output is correct |
24 |
Correct |
60 ms |
4984 KB |
Output is correct |
25 |
Correct |
51 ms |
4992 KB |
Output is correct |
26 |
Correct |
63 ms |
4984 KB |
Output is correct |
27 |
Correct |
59 ms |
4896 KB |
Output is correct |
28 |
Correct |
59 ms |
4988 KB |
Output is correct |
29 |
Correct |
56 ms |
4984 KB |
Output is correct |
30 |
Correct |
39 ms |
4988 KB |
Output is correct |
31 |
Correct |
2 ms |
4176 KB |
Output is correct |
32 |
Correct |
2 ms |
4176 KB |
Output is correct |