Submission #371201

#TimeUsernameProblemLanguageResultExecution timeMemory
371201ja_kingyCircus (Balkan15_CIRCUS)C++14
0 / 100
31 ms2660 KiB
#include "circus.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; vector<pii> mnstk; void init(int N, int M, int P[]){ int it = 0; sort(P, P+N); priority_queue<pii> pq; mnstk.push_back({M,M}); for (int i = N; i-->0;) { while (pq.size() && pq.top().first >= P[i]) { if (pq.top().second < mnstk.back().second) { mnstk.push_back(pq.top()); } pq.pop(); } int req = 2*P[i] - mnstk.back().second; pq.push({req, P[i]}); } } int minLength(int D) { auto p = lower_bound(mnstk.rbegin(), mnstk.rend(), make_pair(D,0)); return p->second - D; }

Compilation message (stderr)

circus.cpp: In function 'void init(int, int, int*)':
circus.cpp:8:9: warning: unused variable 'it' [-Wunused-variable]
    8 |     int it = 0;
      |         ^~
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...