Submission #1199339

#TimeUsernameProblemLanguageResultExecution timeMemory
1199339raphaelpCircus (Balkan15_CIRCUS)C++20
0 / 100
41 ms1088 KiB
#include <bits/stdc++.h> #include "circus.h" using namespace std; set<pair<int, int>> S; void init(int N, int M, int P[]) { S.insert({M, M}); for (int i = N - 1; i >= 0; i--) { auto x = S.lower_bound({P[i], 0}); int d = x->second - P[i]; auto y = S.lower_bound({P[i] - d, 0}); if (y->second > P[i]) S.insert({P[i] - d, P[i]}); y = S.lower_bound({P[i] - d, P[i]}); y--; while (y != S.begin() && y->second >= P[i]) { auto temp = y; y--; S.erase(temp); } } } int minLength(int D) { auto ans = S.lower_bound({D, 0}); return ans->second - D; }

Compilation message (stderr)

grader.cpp: In function 'int main()':
grader.cpp:16:14: 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:22: 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:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         scanf("%d", &Q);
      |         ~~~~~^~~~~~~~~~
grader.cpp:23:22: 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...