//
// --- 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;
const int NN=510;
bool cmp[NN][NN];
void solve(int n, int v)
{
set<pii> inf;
FOR(i, 1, n+1)
{
FOR(j, i+1, n+1)
{
inf.insert({i,j});
}
}
FOR(i, 0, v)
{
set<int> vis;
set<pii> er;
vector<pii> ins;
for(auto it : inf){
int x=it.f, y=it.s;
if(!vis.count(x) && !vis.count(y)){
schedule(x, y);
vis.insert(x);
vis.insert(y);
ins.pb({x,y});
er.insert(it);
}
}
for(auto it : er) inf.erase(it);
vi get=visit();
FOR(j, 0, sz(get))
{
int x=ins[j].f, y=ins[j].s; bool val=get[j];
cmp[x][y]=val;
cmp[y][x]=!val;
}
}
vi ans(n);
// FOR(i, 1, n+1)
// {
// int mr=0;
// FOR(j, 1, n+1)
// {
// mr+=cmp[i][j];
// }
// ans[n-mr-1]=i;
// }
FOR(i, 1, n+1) ans[i-1]=i;
answer(ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
344 KB |
Correct |
2 |
Correct |
34 ms |
600 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
344 KB |
Correct |
2 |
Correct |
34 ms |
600 KB |
Correct |
3 |
Incorrect |
21 ms |
344 KB |
Not correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
344 KB |
Correct |
2 |
Correct |
38 ms |
600 KB |
Correct |
3 |
Correct |
142 ms |
1928 KB |
Correct |
4 |
Correct |
953 ms |
6564 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
344 KB |
Correct |
2 |
Correct |
38 ms |
600 KB |
Correct |
3 |
Correct |
142 ms |
1928 KB |
Correct |
4 |
Correct |
953 ms |
6564 KB |
Correct |
5 |
Incorrect |
23 ms |
344 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
344 KB |
Correct |
2 |
Correct |
38 ms |
600 KB |
Correct |
3 |
Correct |
140 ms |
1928 KB |
Correct |
4 |
Correct |
956 ms |
6816 KB |
Correct |
5 |
Incorrect |
886 ms |
6568 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
344 KB |
Correct |
2 |
Correct |
38 ms |
600 KB |
Correct |
3 |
Correct |
140 ms |
1928 KB |
Correct |
4 |
Correct |
956 ms |
6816 KB |
Correct |
5 |
Incorrect |
886 ms |
6568 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
344 KB |
Correct |
2 |
Correct |
29 ms |
600 KB |
Correct |
3 |
Correct |
143 ms |
1936 KB |
Correct |
4 |
Correct |
964 ms |
6728 KB |
Correct |
5 |
Incorrect |
895 ms |
6564 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
344 KB |
Correct |
2 |
Correct |
29 ms |
600 KB |
Correct |
3 |
Correct |
143 ms |
1936 KB |
Correct |
4 |
Correct |
964 ms |
6728 KB |
Correct |
5 |
Incorrect |
895 ms |
6564 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
344 KB |
Correct |
2 |
Correct |
36 ms |
856 KB |
Correct |
3 |
Correct |
146 ms |
1928 KB |
Correct |
4 |
Correct |
937 ms |
6572 KB |
Correct |
5 |
Incorrect |
893 ms |
6572 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
344 KB |
Correct |
2 |
Correct |
36 ms |
856 KB |
Correct |
3 |
Correct |
146 ms |
1928 KB |
Correct |
4 |
Correct |
937 ms |
6572 KB |
Correct |
5 |
Incorrect |
893 ms |
6572 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |