Submission #1047230

#TimeUsernameProblemLanguageResultExecution timeMemory
1047230PanosPaskCircus (Balkan15_CIRCUS)C++14
0 / 100
4070 ms2140 KiB
#include <bits/stdc++.h> #include "circus.h" using namespace std; int N, M; vector<int> p; vector<int> minlen; void init(int n, int m, int P[]){ N = n; M = m; p.resize(N); minlen.resize(N); for (int i = 0; i < N; i++) { p[i] = P[i]; } sort(p.begin(), p.end()); for (int i = N - 1; i >= 0; i--) { minlen[i] = M - p[i]; for (int j = i + 1; j < N; j++) { if (p[j] - p[i] >= minlen[j]) { minlen[i] = min(minlen[i], p[j] - p[i]); } } } } int minLength(int D) { int pos = lower_bound(p.begin(), p.end(), D) - p.begin(); int ans = M - D; for (int i = pos; i < N; i++) { if (p[i] - D >= minlen[i]) { ans = min(ans, p[i] - D); } } 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...