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 <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)
{
vi a(n); FOR(i, 0, n) a[i]=i+1;
FOR(i, 0, v)
{
if(i&1){
for(int i=1; i+1<n; i+=2){
schedule(a[i], a[i+1]);
}
vi get=visit();
for(int i=1; i+1<n; i+=2){
int in=(i-1)/2;
if(get[in]==0){
swap(a[i], a[i+1]);
}
}
}
else{
for(int i=0; i<n; i+=2){
schedule(a[i], a[i+1]);
}
vi get=visit();
for(int i=0; i<n; i+=2){
int in=i/2;
if(get[in]==0){
swap(a[i], a[i+1]);
}
}
}
}
answer(a);
}
# | 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... |