# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
432852 | 2021-06-18T14:16:01 Z | balbit | 정렬하기 (IOI15_sorting) | C++14 | 1 ms | 460 KB |
#include "sorting.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define f first #define s second #ifdef BALBIT #define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__) template<typename T> void _do( T && x) {cerr<<x<<endl;} template<typename T, typename ...S> void _do( T && x, S && ...y) {cerr<<x<<", "; _do(y...);} #else #define bug(...) #endif // BALBIT #define ALL(x) (x).begin(), (x).end() #define SZ(x) (int )((x).size()) #define pb push_back #define REP(i,n) for (int i = 0; i<n; ++i) #define REP1(i,n) for (int i = 1; i<=n; ++i) #define MX(a,b) a = max(a,b) #define MN(a,b) a = min(a,b) //signed main(){bug(1,2);} int findSwapPairs(int n, int S[], int M, int X[], int Y[], int P[], int Q[]) { assert(n<=5); if (n == 1) return 0; swap(S[0], S[1]); REP(i,M) { // assert(X[i] == 0 && Y[i] == 1); } int IT = 0; REP(B, 2) { if (S[0] != B && S[1] != B) { for (int j = 2; j<n; ++j) { if (S[j] == B) { int k = 0; if (S[k] <= 1) ++k; P[IT] = k; Q[IT] = j; swap(S[k], S[j]); ++IT; swap(S[0], S[1]); } } } } for (int i = 2; i<n; ++i) { // assert(X[i] == 0 && Y[i] == 0); for (int j = i+1; j<n; ++j) { if (S[j] ==i) { P[IT] = i; Q[IT] = j; swap(S[i], S[j]); swap(S[0], S[1]); ++IT; break; } } } assert(min(S[0], S[1]) == 0 && max(S[0], S[1]) == 1); if (S[0] == 0) { P[IT] = 0; Q[IT] = 0; ++IT; swap(S[0], S[1]); } return IT; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Runtime error | 1 ms | 460 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |