Submission #250172

#TimeUsernameProblemLanguageResultExecution timeMemory
250172SomeoneUnknownMinerals (JOI19_minerals)C++14
6 / 100
14 ms512 KiB
#include "minerals.h" #include <bits/stdc++.h> using namespace std; const int b = 208; void Solve(int N) { queue<int> firsts, mbox; for(int i = 1; i <= 2*N; i++){ int res = Query(i); if(firsts.size() < res){ firsts.push(i); }else{ mbox.push(i); } if(mbox.size() >= b){ queue<int> ftrash; while(!mbox.empty()){ int examining = firsts.front(); firsts.pop(); int res2 = Query(examining); if(firsts.size() < res2){ while(Query(mbox.front()) == res2){ Query(mbox.front()); mbox.push(mbox.front()); mbox.pop(); } Answer(examining, mbox.front()); mbox.pop(); }else{ firsts.push(examining); Query(examining); } } } } if(mbox.size() != firsts.size()) int a = 1/0; while(!mbox.empty()){ int res2 = Query(firsts.front()); while(Query(mbox.front()) == res2){ Query(mbox.front()); mbox.push(mbox.front()); mbox.pop(); } Answer(firsts.front(), mbox.front()); mbox.pop(); firsts.pop(); } /*int v = Query(1); for (int i = 1; i <= N; ++i) { Answer(i, 2 * N + 1 - i); }//*/ }

Compilation message (stderr)

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:11:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(firsts.size() < res){
            ~~~~~~~~~~~~~~^~~~~
minerals.cpp:22:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if(firsts.size() < res2){
                    ~~~~~~~~~~~~~~^~~~~~
minerals.cpp:38:47: warning: division by zero [-Wdiv-by-zero]
     if(mbox.size() != firsts.size()) int a = 1/0;
                                              ~^~
minerals.cpp:38:42: warning: unused variable 'a' [-Wunused-variable]
     if(mbox.size() != firsts.size()) int a = 1/0;
                                          ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...