Submission #980654

#TimeUsernameProblemLanguageResultExecution timeMemory
980654Jarif_RahmanMinerals (JOI19_minerals)C++17
6 / 100
9 ms600 KiB
#include "minerals.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; void Solve(int n){ deque<int> added, to_be_added; for(int i = 1; i <= 2*n; i++) to_be_added.push_back(i); int old = 0; while(!added.empty() || !to_be_added.empty()){ int x = Query(to_be_added[0]); added.push_back(to_be_added[0]); to_be_added.pop_front(); if(x > old){ old = x; continue; } int old_ = old; while(1){ int i = added[0]; added.pop_front(); int x = Query(i); if(x == old_){ old = Query(added.back()); Answer(i, added.back()); added.pop_back(); break; } to_be_added.push_back(i); old_ = x; } } }
#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...