# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
432881 | balbit | Sorting (IOI15_sorting) | C++14 | 2 ms | 332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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[]) {
int IT = 0;
if (n == 1) return 0;
bool hey = 0;
REP(i,n) {
if (S[i] != i) {
hey = 1; break;
}
}
if (!hey) return 0;
P[IT] = 0; Q[IT] = 0;
swap(S[0], S[0]);
++IT;
REP(i,n) {
// 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]);
++IT;
break;
}
}
}
// P[IT] = Q[IT] = 0;
// ++IT;
return IT;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |