# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1081596 | 2024-08-30T07:58:30 Z | Trumling | Sorting (IOI15_sorting) | C++17 | 1 ms | 348 KB |
#include "sorting.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define all(x) x.begin(),x.end() #define INF 9999999999999999 typedef long long ll; int findSwapPairs(int N, int ar[], int M, int X[], int Y[], int P[], int Q[]) { int pos[N]; int arr[N]; for(int i=0;i<N;i++) { arr[i]=ar[i]; pos[arr[i]]=i; } vector<pair<int,int>>v; for(int i=0;i<N;i++) { v.pb({pos[i],i}); swap(arr[pos[i]],arr[i]); pos[arr[pos[i]]]=pos[i]; pos[i]=i; } for(int i=0;i<N;i++) arr[i]=ar[i]; for(int i=0;i<v.size();i++) { P[i]=v[i].F; Q[i]=v[i].S; swap(arr[v[i].F],arr[v[i].S]); } assert(is_sorted(arr,arr+N)); return v.size(); }
Compilation message
# | Verdict | Execution time | Memory | 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 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | - |
# | Verdict | Execution time | Memory | 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 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |