# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
60060 | 2018-07-23T14:55:06 Z | Eae02 | 정렬하기 (IOI15_sorting) | C++14 | 3 ms | 512 KB |
#include "sorting.h" #include <bits/stdc++.h> #define all(x) x.begin(),x.end() int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { std::vector<int> sorted(S, S + N); std::sort(all(sorted)); std::vector<int> finalAccess(N); for (int i = 0; i < M; i++) { finalAccess[X[i]] = i; finalAccess[Y[i]] = i; } int R = 0; for (; R < M; R++) { if (std::equal(S, S + N, sorted.begin())) break; std::swap(S[X[R]], S[Y[R]]); auto it = std::find_if(all(finalAccess), [&](int a) { return R >= a; }); if (it == finalAccess.end()) { P[R] = Q[R] = 0; continue; } int index = it - finalAccess.begin(); int val = sorted[index]; auto valIt = std::find(S, S + N, index); std::swap(S[index], *valIt); P[R] = index; Q[R] = valIt - S; } return R; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Incorrect | 3 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Incorrect | 3 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 432 KB | Output is correct |
2 | Incorrect | 3 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Incorrect | 3 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |