Submission #971736

#TimeUsernameProblemLanguageResultExecution timeMemory
971736idasThe Collection Game (BOI21_swaps)C++17
35 / 100
930 ms12728 KiB
// // --- Sample implementation for the task swaps --- // // To compile this program with the sample grader, place: // swaps.h swaps_sample.cpp sample_grader.cpp // in a single folder and run: // g++ swaps_sample.cpp sample_grader.cpp // in this folder. // #include <bits/stdc++.h> using namespace std; #include "swaps.h" #define FOR(i, begin, end) for(int i=(begin); i<(end); i++) #define sz(x) int((x).size()) #define pb push_back #define s second #define f first typedef vector<int> vi; typedef pair<int, int> pii; void solve(int n, int v) { set<pii> inf; FOR(i, 1, n+1) { FOR(j, i+1, n+1) { inf.insert({i,j}); } } vi ans(n); FOR(i, 0, n) ans[i]=i+1; FOR(i, 0, v) { set<int> vis; set<pii> er; vector<pii> ins; for(auto it : inf){ int x=it.f, y=it.s; if(!vis.count(x) && !vis.count(y)){ schedule(ans[x-1], ans[y-1]); vis.insert(x); vis.insert(y); ins.pb({x,y}); er.insert(it); } } for(auto it : er) inf.erase(it); if(i==v-1) assert(inf.empty()); vi get=visit(); FOR(j, 0, sz(get)) { int x=ins[j].f, y=ins[j].s; bool val=get[j]; if(!val){ swap(ans[x-1], ans[y-1]); } } } answer(ans); }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...