Submission #1169907

#TimeUsernameProblemLanguageResultExecution timeMemory
1169907Konti2Minerals (JOI19_minerals)C++20
6 / 100
1025 ms776 KiB
#include "minerals.h" #include <bits/stdc++.h> using namespace std; void Solve(int N) { srand(2137); vector<int> indeksy; for (int i = 1; i <= 2*N; i++) indeksy.push_back(i); int prev = 0; vector<int> wmaszynie; int kand = 0; random_shuffle(indeksy.begin(), indeksy.end()); while (indeksy.size()){ int nowe = Query(indeksy.back()); //cerr << nowe << " " << prev << "\n"; kand = indeksy.back(); indeksy.pop_back(); if (nowe == prev){ //cerr << "wtf\n"; while (wmaszynie.size()){ nowe = Query(wmaszynie.back()); if (nowe == prev){ Answer(wmaszynie.back(), kand); prev = Query(kand); wmaszynie.pop_back(); if (indeksy.size()) random_shuffle(indeksy.begin(), indeksy.end()); break; } prev = nowe; indeksy.push_back(wmaszynie.back()); wmaszynie.pop_back(); } } else{ prev = nowe; wmaszynie.push_back(kand); } } }
#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...