답안 #45384

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
45384 2018-04-13T07:17:46 Z OneSubmissionMan Gap (APIO16_gap) C++11
53.5084 / 100
107 ms 1464 KB
# include "gap.h"
# include <bits/stdc++.h>

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul

const ll N = 1e18;

ll solve_slow (int n) {
  ll a[n + 2];
  a[n + 1] = N + 1;
  a[0] = -1;
  for (int l = 1; l <= (n + 1) / 2; l++) {
    int r = n - l + 1;
    MinMax (a[l - 1] + 1, a[r + 1] - 1, a + l, a + r);
  }          
  ll ans = 0;
  for (int i = 1; i < n; i++)
    ans = max (ans, a[i + 1] - a[i]);
  return ans;
}

long findGap (int t, int n) {  
  ll F, S;
  MinMax (1ll, N, &F, &S);        
  ll len = (S - F - 1) / (n - 1) + 1;
  ll last = F;
  ll ans = 1;
  for (int i = 1; i <= n; i++) {  
    ll x, y;
    MinMax (F + (i - 1) * len, F + i * len - 1, &x, &y);
    if (~x) { 
      ans = max (ans, x - last);
      last = y;               
    }    
  }
  return ans;
}



// Coded by Z..
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 428 KB Output isn't correct
4 Incorrect 2 ms 428 KB Output isn't correct
5 Incorrect 2 ms 488 KB Output isn't correct
6 Incorrect 2 ms 604 KB Output isn't correct
7 Incorrect 2 ms 604 KB Output isn't correct
8 Incorrect 2 ms 604 KB Output isn't correct
9 Incorrect 2 ms 604 KB Output isn't correct
10 Incorrect 2 ms 604 KB Output isn't correct
11 Incorrect 3 ms 604 KB Output isn't correct
12 Incorrect 3 ms 692 KB Output isn't correct
13 Incorrect 4 ms 692 KB Output isn't correct
14 Incorrect 4 ms 692 KB Output isn't correct
15 Incorrect 3 ms 692 KB Output isn't correct
16 Incorrect 20 ms 824 KB Output isn't correct
17 Incorrect 26 ms 824 KB Output isn't correct
18 Incorrect 25 ms 824 KB Output isn't correct
19 Incorrect 19 ms 824 KB Output isn't correct
20 Incorrect 10 ms 824 KB Output isn't correct
21 Incorrect 79 ms 1372 KB Output isn't correct
22 Incorrect 75 ms 1372 KB Output isn't correct
23 Incorrect 107 ms 1464 KB Output isn't correct
24 Incorrect 76 ms 1464 KB Output isn't correct
25 Incorrect 80 ms 1464 KB Output isn't correct
26 Incorrect 74 ms 1464 KB Output isn't correct
27 Incorrect 96 ms 1464 KB Output isn't correct
28 Incorrect 98 ms 1464 KB Output isn't correct
29 Incorrect 78 ms 1464 KB Output isn't correct
30 Incorrect 39 ms 1464 KB Output isn't correct
31 Incorrect 2 ms 1464 KB Output isn't correct
32 Incorrect 2 ms 1464 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2 ms 1464 KB Partially correct
2 Partially correct 2 ms 1464 KB Partially correct
3 Partially correct 2 ms 1464 KB Partially correct
4 Partially correct 2 ms 1464 KB Partially correct
5 Partially correct 2 ms 1464 KB Partially correct
6 Partially correct 2 ms 1464 KB Partially correct
7 Partially correct 2 ms 1464 KB Partially correct
8 Partially correct 2 ms 1464 KB Partially correct
9 Partially correct 2 ms 1464 KB Partially correct
10 Partially correct 2 ms 1464 KB Partially correct
11 Partially correct 4 ms 1464 KB Partially correct
12 Partially correct 3 ms 1464 KB Partially correct
13 Partially correct 3 ms 1464 KB Partially correct
14 Partially correct 4 ms 1464 KB Partially correct
15 Partially correct 3 ms 1464 KB Partially correct
16 Partially correct 27 ms 1464 KB Partially correct
17 Partially correct 19 ms 1464 KB Partially correct
18 Partially correct 27 ms 1464 KB Partially correct
19 Partially correct 20 ms 1464 KB Partially correct
20 Partially correct 10 ms 1464 KB Partially correct
21 Partially correct 74 ms 1464 KB Partially correct
22 Partially correct 75 ms 1464 KB Partially correct
23 Partially correct 77 ms 1464 KB Partially correct
24 Partially correct 78 ms 1464 KB Partially correct
25 Partially correct 85 ms 1464 KB Partially correct
26 Partially correct 76 ms 1464 KB Partially correct
27 Partially correct 74 ms 1464 KB Partially correct
28 Partially correct 74 ms 1464 KB Partially correct
29 Partially correct 88 ms 1464 KB Partially correct
30 Partially correct 39 ms 1464 KB Partially correct
31 Partially correct 2 ms 1464 KB Partially correct
32 Partially correct 2 ms 1464 KB Partially correct