# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
621396 | 2022-08-03T18:24:45 Z | A_D | 정렬하기 (IOI15_sorting) | C++14 | 14 ms | 472 KB |
#include "sorting.h" #include <bits/stdc++.h> using namespace std; const int N=2e5+100; int a[N]; pair<int,int> b[N]; int n; int num=0; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { num=0; n=N; for(int i=0;i<N;i++){ a[i]=S[i]; b[i]={a[i],i}; } sort(b,b+n); for(int i=0;i<n;i++){ a[b[i].second]=i; } if(n==1)return num; for(int i=0;i<n;i++){ int f=1; for(int j=i+1;j<n;j++){ if(a[j]==i){ if(num==M)break; P[num]=i; Q[num]=j; swap(a[i],a[j]); num++; } f=1; for(int h=0;h<n;h++){ if(a[h]!=h)f=0; } if(f)break; if(num==M)break; P[num]=0; Q[num]=0; num++; f=1; for(int h=0;h<n;h++){ if(a[h]!=h)f=0; } if(f)break; } if(f)break; } return num; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 312 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 312 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Incorrect | 3 ms | 340 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 336 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 312 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Incorrect | 3 ms | 340 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 472 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 472 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |