This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
#include "swaps.h"
#define ll long long
#define ld long double
#define F first
#define S second
#define PB push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define vi vector<int>
#define vl vector<ll>
#define CASE int t;cin>>t;for(int ca=1;ca<=t;ca++)
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
using namespace std;
const int MAX = 1 << 20, MOD = 1e9 + 7;
int a[MAX];
void solve(int N, int V) {
vi v;
ll n = N;
if(n == 1){
answer({1});
return;
}
for(int i = 1;i <= n;i++) {
a[i] = i;
}
int cl = 1;
for(int c = 0;c < n;c++){
int l = cl;
vector<pii> vp;
while(l + 1 <= n){
schedule(a[l], a[l + 1]);
vp.PB({l, l + 1});
l += 2;
}
vi vv = visit();
for(int i = 0;i < SZ(vp);i++)
if(vv[i] == 0)
swap(a[vp[i].F], a[vp[i].S]);
if(cl == 2){
cl = 1;
}
else{
cl = 2;
}
}
for(int i = 1;i <= n;i++)
v.PB(a[i]);
answer(v);
}
Compilation message (stderr)
swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:44:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
44 | if(vv[i] == 0)
| ^~
swaps.cpp:46:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
46 | if(cl == 2){
| ^~
swaps.cpp:53:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
53 | for(int i = 1;i <= n;i++)
| ^~~
swaps.cpp:55:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
55 | answer(v);
| ^~~~~~
# | 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... |