Submission #303707

# Submission time Handle Problem Language Result Execution time Memory
303707 2020-09-20T14:48:11 Z dolphingarlic Circus (Balkan15_CIRCUS) C++14
0 / 100
28 ms 1792 KB
#include "circus.h"

#include <algorithm>
#include <iostream>

int n, m, p[100000];

void init(int N, int M, int P[]){
    n = N, m = M;
    for (int i = 0; i < n; i++) p[i] = P[i];
    std::sort(p, p + n);
}

bool possible(int len, int pos) {
    while (1) {
        if (len >= m - pos) return true;
        int nxt = std::upper_bound(p, p + n, pos + len) - p - 1;
        if (nxt == -1 || p[nxt] <= pos) return false;
        len = p[nxt] - pos;
        pos = p[nxt];
    }
}

int minLength(int D) {
    int ans = 0;
    for (int i = (1 << 30); i; i >>= 1)
        ans += !possible(ans + i - 1, D) * i;
    return ans;
}

Compilation message

grader.cpp: In function 'int main()':
grader.cpp:14:12: warning: unused variable 'max_code' [-Wunused-variable]
   14 |  long long max_code;
      |            ^~~~~~~~
grader.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%d%d", &N, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~
grader.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |   scanf("%d", &P[i]);
      |   ~~~~~^~~~~~~~~~~~~
grader.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |  scanf("%d", &Q);
      |  ~~~~~^~~~~~~~~~
grader.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |   scanf("%d", &d);
      |   ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1792 KB Output isn't correct
2 Halted 0 ms 0 KB -