This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define fi first
#define se second
ll MOD = 1000000007;
ll power(ll base, ll n){
if (n == 0) return 1;
if (n == 1) return base;
ll halfn = power(base, n/2);
if (n % 2 == 0) return (halfn * halfn) % MOD;
return (((halfn * halfn) % MOD) * base) % MOD;
}
ll inverse(ll n){
return power(n, MOD-2);
}
ll add(ll a, ll b){
return (a+b) % MOD;
}
ll mul(ll a, ll b){
a %= MOD;
return (a*b) % MOD;
}
ll gcd(ll a, ll b){
if (a == 1) return 1;
if (a == 0) return b;
return gcd(b%a, a);
}
ll INF = (MOD-7)*(MOD-7);
ll findGap(int t, int n){
if (t == 1){
vector<ll> a;
ll L = 0, R = INF;
FOR(i,0,(n+1)/2){
ll mn, mx;
MinMax(L,R,&mn,&mx);
a.pb(mn); a.pb(mx);
L = mn+1, R = mx-1;
}
sort(a.begin(), a.end());
ll maxi = 0;
FOR(i,1,a.size()){
maxi = max(maxi, a[i]-a[i-1]);
}
return maxi;
}
return 0;
}
Compilation message (stderr)
gap.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
6 | #pragma GCC optimization ("Ofast")
|
gap.cpp:7: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
7 | #pragma GCC optimization ("unroll-loops")
|
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:15:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | #define FOR(i, a, b) for(int i = a; i < b; i++)
......
64 | FOR(i,1,a.size()){
| ~~~~~~~~~~~~
gap.cpp:64:3: note: in expansion of macro 'FOR'
64 | FOR(i,1,a.size()){
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |