Submission #45390

# Submission time Handle Problem Language Result Execution time Memory
45390 2018-04-13T07:51:53 Z OneSubmissionMan Gap (APIO16_gap) C++11
0 / 100
121 ms 1632 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) / 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 376 KB Output isn't correct
3 Incorrect 2 ms 416 KB Output isn't correct
4 Incorrect 2 ms 428 KB Output isn't correct
5 Incorrect 2 ms 476 KB Output isn't correct
6 Incorrect 2 ms 480 KB Output isn't correct
7 Incorrect 2 ms 480 KB Output isn't correct
8 Incorrect 2 ms 512 KB Output isn't correct
9 Incorrect 2 ms 512 KB Output isn't correct
10 Incorrect 2 ms 688 KB Output isn't correct
11 Incorrect 3 ms 688 KB Output isn't correct
12 Incorrect 3 ms 688 KB Output isn't correct
13 Incorrect 3 ms 688 KB Output isn't correct
14 Incorrect 3 ms 688 KB Output isn't correct
15 Incorrect 4 ms 688 KB Output isn't correct
16 Incorrect 25 ms 724 KB Output isn't correct
17 Incorrect 25 ms 740 KB Output isn't correct
18 Incorrect 26 ms 868 KB Output isn't correct
19 Incorrect 29 ms 868 KB Output isn't correct
20 Incorrect 14 ms 868 KB Output isn't correct
21 Incorrect 98 ms 1412 KB Output isn't correct
22 Incorrect 101 ms 1416 KB Output isn't correct
23 Incorrect 98 ms 1416 KB Output isn't correct
24 Incorrect 99 ms 1416 KB Output isn't correct
25 Incorrect 99 ms 1516 KB Output isn't correct
26 Incorrect 97 ms 1516 KB Output isn't correct
27 Incorrect 102 ms 1516 KB Output isn't correct
28 Incorrect 105 ms 1516 KB Output isn't correct
29 Incorrect 105 ms 1516 KB Output isn't correct
30 Incorrect 69 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 4 ms 1516 KB Partially correct
13 Partially correct 4 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 24 ms 1516 KB Partially correct
17 Partially correct 24 ms 1516 KB Partially correct
18 Partially correct 25 ms 1516 KB Partially correct
19 Partially correct 34 ms 1516 KB Partially correct
20 Incorrect 14 ms 1516 KB Output isn't correct
21 Partially correct 114 ms 1528 KB Partially correct
22 Partially correct 113 ms 1528 KB Partially correct
23 Partially correct 110 ms 1528 KB Partially correct
24 Partially correct 95 ms 1536 KB Partially correct
25 Partially correct 96 ms 1536 KB Partially correct
26 Partially correct 108 ms 1536 KB Partially correct
27 Partially correct 119 ms 1536 KB Partially correct
28 Partially correct 121 ms 1632 KB Partially correct
29 Partially correct 98 ms 1632 KB Partially correct
30 Incorrect 59 ms 1632 KB Output isn't correct
31 Partially correct 2 ms 1632 KB Partially correct
32 Partially correct 2 ms 1632 KB Partially correct