Submission #45392

# Submission time Handle Problem Language Result Execution time Memory
45392 2018-04-13T07:55:15 Z OneSubmissionMan Gap (APIO16_gap) C++11
0 / 100
122 ms 1640 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;
}

ll findGap (int t, int n) {  
  ll F, S;
  MinMax (1ll, N, &F, &S);        
  ll len = max (1ll, ((S - F - 1) / (n - 1) + 1) / 2);
  ll last = F;
  ll ans = len;   
  F++;      
  for (ll i = 1; i <= 2*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..
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Incorrect 2 ms 356 KB Output isn't correct
3 Incorrect 2 ms 408 KB Output isn't correct
4 Incorrect 2 ms 484 KB Output isn't correct
5 Incorrect 2 ms 484 KB Output isn't correct
6 Incorrect 2 ms 544 KB Output isn't correct
7 Incorrect 2 ms 544 KB Output isn't correct
8 Incorrect 2 ms 592 KB Output isn't correct
9 Incorrect 2 ms 720 KB Output isn't correct
10 Incorrect 2 ms 720 KB Output isn't correct
11 Incorrect 3 ms 720 KB Output isn't correct
12 Incorrect 10 ms 720 KB Output isn't correct
13 Incorrect 3 ms 720 KB Output isn't correct
14 Incorrect 3 ms 720 KB Output isn't correct
15 Incorrect 4 ms 720 KB Output isn't correct
16 Incorrect 26 ms 920 KB Output isn't correct
17 Incorrect 31 ms 920 KB Output isn't correct
18 Incorrect 26 ms 920 KB Output isn't correct
19 Incorrect 28 ms 920 KB Output isn't correct
20 Incorrect 15 ms 920 KB Output isn't correct
21 Incorrect 98 ms 1440 KB Output isn't correct
22 Incorrect 113 ms 1516 KB Output isn't correct
23 Incorrect 97 ms 1516 KB Output isn't correct
24 Incorrect 100 ms 1516 KB Output isn't correct
25 Incorrect 99 ms 1640 KB Output isn't correct
26 Incorrect 99 ms 1640 KB Output isn't correct
27 Incorrect 100 ms 1640 KB Output isn't correct
28 Incorrect 98 ms 1640 KB Output isn't correct
29 Incorrect 105 ms 1640 KB Output isn't correct
30 Incorrect 58 ms 1640 KB Output isn't correct
31 Incorrect 2 ms 1640 KB Output isn't correct
32 Incorrect 2 ms 1640 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 1640 KB Partially correct
2 Partially correct 2 ms 1640 KB Partially correct
3 Partially correct 2 ms 1640 KB Partially correct
4 Partially correct 4 ms 1640 KB Partially correct
5 Partially correct 2 ms 1640 KB Partially correct
6 Partially correct 2 ms 1640 KB Partially correct
7 Partially correct 2 ms 1640 KB Partially correct
8 Partially correct 2 ms 1640 KB Partially correct
9 Partially correct 2 ms 1640 KB Partially correct
10 Partially correct 2 ms 1640 KB Partially correct
11 Partially correct 3 ms 1640 KB Partially correct
12 Partially correct 3 ms 1640 KB Partially correct
13 Partially correct 4 ms 1640 KB Partially correct
14 Partially correct 3 ms 1640 KB Partially correct
15 Partially correct 4 ms 1640 KB Partially correct
16 Partially correct 25 ms 1640 KB Partially correct
17 Partially correct 25 ms 1640 KB Partially correct
18 Partially correct 25 ms 1640 KB Partially correct
19 Partially correct 28 ms 1640 KB Partially correct
20 Partially correct 15 ms 1640 KB Partially correct
21 Partially correct 98 ms 1640 KB Partially correct
22 Partially correct 98 ms 1640 KB Partially correct
23 Partially correct 100 ms 1640 KB Partially correct
24 Partially correct 105 ms 1640 KB Partially correct
25 Partially correct 122 ms 1640 KB Partially correct
26 Partially correct 97 ms 1640 KB Partially correct
27 Partially correct 98 ms 1640 KB Partially correct
28 Partially correct 111 ms 1640 KB Partially correct
29 Partially correct 122 ms 1640 KB Partially correct
30 Incorrect 68 ms 1640 KB Output isn't correct
31 Partially correct 2 ms 1640 KB Partially correct
32 Partially correct 2 ms 1640 KB Partially correct