Submission #303707

#TimeUsernameProblemLanguageResultExecution timeMemory
303707dolphingarlicCircus (Balkan15_CIRCUS)C++14
0 / 100
28 ms1792 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...