Submission #971527

#TimeUsernameProblemLanguageResultExecution timeMemory
971527CyberCowThe Collection Game (BOI21_swaps)C++17
50 / 100
311 ms1884 KiB
#include "swaps.h" #include <vector> using namespace std; int arj[505]; void solve(int N, int V) { for (int i = 1; i <= N; i++) { arj[i] = i; } for (int i = 0; i < V; i++) { if (i % 2) { for (int j = 1; j < N; j += 2) { schedule(arj[j], arj[j + 1]); } } else { for (int j = 2; j < N; j += 2) { schedule(arj[j], arj[j + 1]); } schedule(arj[1], arj[N]); } vector<int> visa = visit(); if (i % 2) { for (int j = 1; j < N; j += 2) { if (visa[j / 2] == 0) { swap(arj[j], arj[j + 1]); } } } else { for (int j = 2; j < N; j += 2) { if (visa[j / 2 - 1] == 0) { swap(arj[j], arj[j + 1]); } } if (visa.back() == 0) { swap(arj[1], arj[N]); } } } vector<int> v; for (int i = 1; i <= N; i++) { v.push_back(arj[i]); } answer(v); }
#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...