# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
873945 | Faisal_Saqib | The Collection Game (BOI21_swaps) | C++17 | 50 ms | 1100 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//
// --- 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 "swaps.h"
#include <iostream>
#include <set>
#include <vector>
using namespace std;
int DNC(vector<int>& next)
{
if(next.size()==1)
return next[0];
vector<int> fop;
for(int i=0;(i+1)<next.size();i+=2)
schedule(next[i],next[i+1]);
auto pk=visit();
for(int i=0,j=0;i<next.size();i+=2,j++)
{
if((i+1)<next.size())
{
if(pk[j])
fop.push_back(next[i]);
else
fop.push_back(next[i+1]);
}
else
fop.push_back(next[i]);
}
return DNC(fop);
}
void solve(int n, int v) {
vector<int> ap1;
set<int> ful;
for(int i=1;i<=n;i++)
ful.insert(i);
for(int i=1;i<=n;i++)
{
vector<int> ap;
for(auto i:ful)
ap.push_back(i);
ap1.push_back(DNC(ap));
ful.erase(ap1.back());
}
answer(ap1);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |