# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
484037 | 2021-11-01T23:45:17 Z | Cross_Ratio | Sorting (IOI15_sorting) | C++14 | 1 ms | 460 KB |
#include <bits/stdc++.h> #include "sorting.h" using namespace std; typedef pair<long long int, int> P; vector<P> So; vector<long long int> S; vector<int> X, Y; int N; int findSwapPairs(int N2, int S2[], int M, int X2[], int Y2[], int P1[], int P2[]) { N = N2; int i, j; for(i=0;i<N;i++) { So.push_back(P(S2[i],i)); S.push_back(S2[i]); X.push_back(X2[i]); Y.push_back(Y2[i]); } for(i=0;i<N;i++) { So[i].first = N * So[i].first + i; S[i] = N * S[i] + i; } sort(So.begin(),So.end()); int cnt = 0; for(i=0;i<N;i++) { if(S[i] == So[i].first) continue; P1[cnt] = i; P2[cnt] = So[i].second; swap(S[i],S[So[i].second]); cnt++; } return cnt; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 284 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Incorrect | 0 ms | 204 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 284 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Incorrect | 0 ms | 204 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 0 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 284 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Incorrect | 0 ms | 204 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 460 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 460 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |