This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
//#define int long long
#define double long double
#define FOR(i, l, r, d) for(int i=(l); i<=(r); i+=(d))
#define szof(x) ((int)(x).size())
#define vi vector<int>
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define mkp make_pair
const int INF = 2147483647;
//const int LNF = INF*INF;
const int MOD = 1000000007;
const int mod = 998244353;
const double eps = 1e-12;
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
int gr[501][501];
bool vis[501];
bool cmp(int a, int b){
return gr[a][b];
}
void solve(int N, int V){
FOR(dis, 1, N-1, 1){
FOR(i, 1, N, 1){
vis[i] = 0;
}
vector<pii> qu1, qu2;
FOR(L, 1, N-dis, 1){
int R = L + dis;
if(vis[L] == 0 and vis[R] == 0){
vis[L] = vis[R] = 1;
qu1.eb(L, R);
}
else{
qu2.eb(L, R);
}
}
for(pii i : qu1){
schedule(i.F, i.S);
}
vi ans = visit();
FOR(i, 0, szof(qu1) - 1, 1){
gr[qu1[i].F][qu1[i].S] = ans[i];
gr[qu1[i].S][qu1[i].F] = ans[i] ^ 1;
}
for(pii i : qu2){
schedule(i.F, i.S);
}
ans = visit();
FOR(i, 0, szof(qu2) - 1, 1){
gr[qu2[i].F][qu2[i].S] = ans[i];
gr[qu2[i].S][qu2[i].F] = ans[i] ^ 1;
}
}
vi res;
FOR(i, 1, N, 1){
res.pb(i);
}
/*
FOR(i, 1, N, 1){
FOR(j, 1, N, 1){
cerr<<gr[i][j]<<" ";
}
cerr<<endl;
}
cerr<<endl;
*/
sort(res.begin(), res.end(), cmp);
answer(res);
}
# | 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... |