# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
851248 | 2023-09-19T06:36:49 Z | 12345678 | 정렬하기 (IOI15_sorting) | C++17 | 1000 ms | 15048 KB |
#include "sorting.h" #include <bits/stdc++.h> using namespace std; const int nx=2e3+5; int dp[nx][nx], cnt(0); vector<pair<int, int>> ans; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { for (int i=0; i<N; i++) dp[0][i]=S[i]; bool f=1; for (int i=0; i<N; i++) if (S[i]!=i) f=0; if (f) return 0; for (int i=1; i<=N; i++) { for (int j=0; j<N; j++) dp[i][j]=dp[i-1][j]; swap(dp[i][X[i-1]], dp[i][Y[i-1]]); ans.clear(); vector<int> l(N); for (int j=0; j<N; j++) l[j]=dp[i][j]; for (int j=0; j<N; j++) for (int k=j+1; k<N; k++) if (l[k]==j) ans.push_back({j, k}), swap(l[k], l[j]); if (ans.size()<=i) { while (ans.size()<i) ans.push_back({0, 0}); break; } } cnt=ans.size(); for (int i=0; i<cnt; i++) P[i]=ans[i].first, Q[i]=ans[i].second; return cnt; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 ms | 2472 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 ms | 2472 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Incorrect | 0 ms | 348 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1004 ms | 15048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1004 ms | 15048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |