답안 #536194

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536194 2022-03-12T15:03:08 Z DJ035 Gap (APIO16_gap) C++17
100 / 100
56 ms 1864 KB
#include "gap.h"
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include <bits/stdc++.h>
#define MEM 111111
#define sanic ios_base::sync_with_stdio(0)
#define x first
#define y second
#define pf push_front
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
const ll INF = 1e17+7;
const ll MOD = 998244353;
ll gcd(ll a, ll b){
    if(a%b) return gcd(b, a%b);
    return b;
}
ll t,n,m;
ll a[MEM];
ll findGap(int T, int N)
{
	if(T==1){
        ll l=0, r=1e18, s=0, e=N-1;
        for(int i=0; i<(N+1)/2; i++){
            MinMax(l, r, &l, &r);
            a[s] = l;
            a[e] = r;
            l++, r--;
            s++, e--;
        }
        ll ans=0;
        for(int i=0; i<N-1; i++)
            ans = max(ans, a[i+1]-a[i]);
        return ans;
	}
	else{
        ll mn, mx;
        MinMax(0,1e18,&mn,&mx);
        ll sz=(mx-mn+N-1)/N;
        ll ans=0, tp=mn;
        for(int i=0; i<N; i++){
            ll s=mn+i*sz+1, e=mn+(i+1)*sz;
            ll gmx, gmn;
            MinMax(s,e,&gmn,&gmx);
            if(gmn==-1) continue;
            ans = max(ans, gmn-tp);
            tp = gmx;
        }
        return ans;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 10 ms 704 KB Output is correct
17 Correct 9 ms 708 KB Output is correct
18 Correct 10 ms 604 KB Output is correct
19 Correct 13 ms 656 KB Output is correct
20 Correct 8 ms 592 KB Output is correct
21 Correct 39 ms 1864 KB Output is correct
22 Correct 45 ms 1852 KB Output is correct
23 Correct 39 ms 1864 KB Output is correct
24 Correct 38 ms 1744 KB Output is correct
25 Correct 34 ms 1792 KB Output is correct
26 Correct 37 ms 1828 KB Output is correct
27 Correct 40 ms 1848 KB Output is correct
28 Correct 40 ms 1772 KB Output is correct
29 Correct 36 ms 1772 KB Output is correct
30 Correct 37 ms 1812 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 15 ms 512 KB Output is correct
17 Correct 15 ms 464 KB Output is correct
18 Correct 13 ms 464 KB Output is correct
19 Correct 13 ms 428 KB Output is correct
20 Correct 8 ms 520 KB Output is correct
21 Correct 56 ms 1144 KB Output is correct
22 Correct 56 ms 1040 KB Output is correct
23 Correct 51 ms 1060 KB Output is correct
24 Correct 52 ms 1032 KB Output is correct
25 Correct 53 ms 1084 KB Output is correct
26 Correct 54 ms 1088 KB Output is correct
27 Correct 54 ms 1064 KB Output is correct
28 Correct 54 ms 1088 KB Output is correct
29 Correct 50 ms 1084 KB Output is correct
30 Correct 27 ms 1064 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct