Submission #932665

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9326652024-02-24 02:28:43Programmer123Fountain Parks (IOI21_parks)C++17
55 / 100
2828 ms85324 KiB
#include <bits/stdc++.h>
#include "parks.h"
std::unordered_map<int, int> map[200001];
int N;
std::vector<std::pair<int, int>> vld[200000];
std::pair<int, int> assigned[200000];
std::set<std::pair<int, int>> taken;
time_t stop;
std::default_random_engine Rand(std::random_device{}());
bool shuffle = false;
bool backtrack(int n) {
if (n == N - 1) return true;
if (clock() > stop) return false;
if (shuffle && vld[n].size() == 2 && Rand() % 2) {
std::swap(vld[n][0], vld[n][1]);
}
for (auto a: vld[n]) {
if (taken.count(a)) continue;
taken.insert(a);
if (backtrack(n + 1)) {
assigned[n] = a;
return true;
}
taken.erase(a);
}
return false;
}
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...