Submission #45391

# Submission time Handle Problem Language Result Execution time Memory
45391 2018-04-13T07:52:50 Z OneSubmissionMan Gap (APIO16_gap) C++11
0 / 100
138 ms 1532 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 = 1;   
  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 376 KB Output isn't correct
2 Incorrect 2 ms 488 KB Output isn't correct
3 Incorrect 2 ms 488 KB Output isn't correct
4 Incorrect 2 ms 580 KB Output isn't correct
5 Incorrect 2 ms 580 KB Output isn't correct
6 Incorrect 2 ms 580 KB Output isn't correct
7 Incorrect 2 ms 580 KB Output isn't correct
8 Incorrect 2 ms 680 KB Output isn't correct
9 Incorrect 2 ms 680 KB Output isn't correct
10 Incorrect 2 ms 680 KB Output isn't correct
11 Incorrect 3 ms 680 KB Output isn't correct
12 Incorrect 4 ms 680 KB Output isn't correct
13 Incorrect 3 ms 700 KB Output isn't correct
14 Incorrect 3 ms 700 KB Output isn't correct
15 Incorrect 3 ms 700 KB Output isn't correct
16 Incorrect 27 ms 716 KB Output isn't correct
17 Incorrect 25 ms 716 KB Output isn't correct
18 Incorrect 25 ms 768 KB Output isn't correct
19 Incorrect 28 ms 768 KB Output isn't correct
20 Incorrect 15 ms 768 KB Output isn't correct
21 Incorrect 104 ms 1400 KB Output isn't correct
22 Incorrect 125 ms 1400 KB Output isn't correct
23 Incorrect 100 ms 1400 KB Output isn't correct
24 Incorrect 117 ms 1400 KB Output isn't correct
25 Incorrect 102 ms 1400 KB Output isn't correct
26 Incorrect 105 ms 1400 KB Output isn't correct
27 Incorrect 138 ms 1400 KB Output isn't correct
28 Incorrect 98 ms 1516 KB Output isn't correct
29 Incorrect 102 ms 1516 KB Output isn't correct
30 Incorrect 91 ms 1516 KB Output isn't correct
31 Incorrect 2 ms 1516 KB Output isn't correct
32 Incorrect 2 ms 1516 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 1516 KB Partially correct
2 Partially correct 2 ms 1516 KB Partially correct
3 Partially correct 2 ms 1516 KB Partially correct
4 Partially correct 2 ms 1516 KB Partially correct
5 Partially correct 2 ms 1516 KB Partially correct
6 Partially correct 2 ms 1516 KB Partially correct
7 Partially correct 2 ms 1516 KB Partially correct
8 Partially correct 2 ms 1516 KB Partially correct
9 Partially correct 2 ms 1516 KB Partially correct
10 Partially correct 2 ms 1516 KB Partially correct
11 Partially correct 3 ms 1516 KB Partially correct
12 Partially correct 3 ms 1516 KB Partially correct
13 Partially correct 3 ms 1516 KB Partially correct
14 Partially correct 3 ms 1516 KB Partially correct
15 Partially correct 4 ms 1516 KB Partially correct
16 Partially correct 35 ms 1516 KB Partially correct
17 Partially correct 24 ms 1516 KB Partially correct
18 Partially correct 27 ms 1516 KB Partially correct
19 Partially correct 35 ms 1516 KB Partially correct
20 Partially correct 14 ms 1516 KB Partially correct
21 Partially correct 106 ms 1532 KB Partially correct
22 Partially correct 106 ms 1532 KB Partially correct
23 Partially correct 115 ms 1532 KB Partially correct
24 Partially correct 101 ms 1532 KB Partially correct
25 Partially correct 101 ms 1532 KB Partially correct
26 Partially correct 102 ms 1532 KB Partially correct
27 Partially correct 99 ms 1532 KB Partially correct
28 Partially correct 129 ms 1532 KB Partially correct
29 Partially correct 96 ms 1532 KB Partially correct
30 Incorrect 60 ms 1532 KB Output isn't correct
31 Partially correct 2 ms 1532 KB Partially correct
32 Partially correct 2 ms 1532 KB Partially correct