//
// --- 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 <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
using namespace std;
using ll = long long;
template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; }
template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; }
void solve(int N, int V) {
vector<bool> used(N);
vector<int> ans;
rep (_, N) {
int cur = -1;
rep (i, N) {
if (used[i]) continue;
if (cur == -1) cur = i;
else {
schedule(cur + 1, i + 1);
if (visit()[0] == 0) cur = i;
}
}
used[cur] = true;
ans.push_back(cur + 1);
}
answer(ans);
}
/*
sub2. マージソートの各マージを並列にすると通る
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
19 ms |
344 KB |
Correct |
3 |
Runtime error |
23 ms |
412 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
22 ms |
344 KB |
Correct |
3 |
Runtime error |
17 ms |
428 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
21 ms |
344 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
21 ms |
344 KB |
Correct |
3 |
Correct |
1 ms |
344 KB |
Correct |
4 |
Correct |
18 ms |
344 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
18 ms |
344 KB |
Correct |
3 |
Runtime error |
19 ms |
412 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
18 ms |
344 KB |
Correct |
3 |
Runtime error |
19 ms |
412 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
27 ms |
344 KB |
Correct |
3 |
Runtime error |
27 ms |
592 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
27 ms |
344 KB |
Correct |
3 |
Runtime error |
27 ms |
592 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
20 ms |
344 KB |
Correct |
3 |
Runtime error |
19 ms |
592 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
20 ms |
344 KB |
Correct |
3 |
Runtime error |
19 ms |
592 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Correct |
2 |
Correct |
21 ms |
344 KB |
Correct |
3 |
Runtime error |
18 ms |
592 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Correct |
2 |
Correct |
21 ms |
344 KB |
Correct |
3 |
Runtime error |
18 ms |
592 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |