Submission #1015133

# Submission time Handle Problem Language Result Execution time Memory
1015133 2024-07-06T06:34:19 Z vjudge1 Gap (APIO16_gap) C++17
0 / 100
21 ms 2020 KB
#include<bits/stdc++.h>
#include "gap.h"

using namespace std;

typedef long long ll;

ll subtask1(int N)
{
  int i = 0, j = N - 1;
  ll s = 0, e = 1e18;
  ll *mn, *mx;

  vector<ll> v(N);
  
  while(i <= j && s <= e)
    {
      MinMax(s, e, mn, mx);
      v[i] = *mn;
      v[j] = *mx;
      i++, j--;
      s = *mn + 1;
      e = *mx - 1;
    }

  ll ans = 0;
  for(int i = 1; i < v.size(); i++)
    ans = max(ans, v[i] - v[i - 1]);
  // cerr << ans << endl;
  return ans;
}

ll findGap(int T, int N)
{
  if(T == 1)
    return subtask1(N);
  return 1ll * N;
}

Compilation message

gap.cpp: In function 'll subtask1(int)':
gap.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for(int i = 1; i < v.size(); i++)
      |                  ~~^~~~~~~~~~
gap.cpp:18:13: warning: 'mn' may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |       MinMax(s, e, mn, mx);
      |       ~~~~~~^~~~~~~~~~~~~~
gap.cpp:18:13: warning: 'mx' may be used uninitialized in this function [-Wmaybe-uninitialized]
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
10 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
11 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
12 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
13 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
14 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
15 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
16 Runtime error 3 ms 856 KB Execution failed because the return code was nonzero
17 Runtime error 5 ms 856 KB Execution failed because the return code was nonzero
18 Runtime error 4 ms 724 KB Execution failed because the return code was nonzero
19 Runtime error 3 ms 856 KB Execution failed because the return code was nonzero
20 Runtime error 2 ms 856 KB Execution failed because the return code was nonzero
21 Runtime error 12 ms 1892 KB Execution failed because the return code was nonzero
22 Runtime error 21 ms 1876 KB Execution failed because the return code was nonzero
23 Runtime error 13 ms 1880 KB Execution failed because the return code was nonzero
24 Runtime error 21 ms 1880 KB Execution failed because the return code was nonzero
25 Runtime error 10 ms 1880 KB Execution failed because the return code was nonzero
26 Runtime error 12 ms 1888 KB Execution failed because the return code was nonzero
27 Runtime error 13 ms 1880 KB Execution failed because the return code was nonzero
28 Runtime error 19 ms 2020 KB Execution failed because the return code was nonzero
29 Runtime error 13 ms 1880 KB Execution failed because the return code was nonzero
30 Runtime error 8 ms 1880 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Incorrect 0 ms 344 KB Output isn't correct
5 Incorrect 0 ms 344 KB Output isn't correct
6 Incorrect 0 ms 344 KB Output isn't correct
7 Incorrect 0 ms 344 KB Output isn't correct
8 Incorrect 0 ms 344 KB Output isn't correct
9 Incorrect 1 ms 344 KB Output isn't correct
10 Incorrect 1 ms 344 KB Output isn't correct
11 Incorrect 0 ms 344 KB Output isn't correct
12 Incorrect 1 ms 344 KB Output isn't correct
13 Incorrect 0 ms 344 KB Output isn't correct
14 Incorrect 1 ms 344 KB Output isn't correct
15 Incorrect 1 ms 344 KB Output isn't correct
16 Incorrect 4 ms 600 KB Output isn't correct
17 Incorrect 5 ms 600 KB Output isn't correct
18 Incorrect 4 ms 600 KB Output isn't correct
19 Incorrect 3 ms 600 KB Output isn't correct
20 Incorrect 2 ms 600 KB Output isn't correct
21 Incorrect 17 ms 1148 KB Output isn't correct
22 Incorrect 12 ms 1112 KB Output isn't correct
23 Incorrect 12 ms 1112 KB Output isn't correct
24 Incorrect 13 ms 1112 KB Output isn't correct
25 Incorrect 10 ms 1112 KB Output isn't correct
26 Incorrect 13 ms 1112 KB Output isn't correct
27 Incorrect 12 ms 1112 KB Output isn't correct
28 Incorrect 16 ms 1112 KB Output isn't correct
29 Incorrect 14 ms 1112 KB Output isn't correct
30 Incorrect 14 ms 1112 KB Output isn't correct
31 Incorrect 0 ms 344 KB Output isn't correct
32 Incorrect 1 ms 344 KB Output isn't correct