Submission #252176

#TimeUsernameProblemLanguageResultExecution timeMemory
252176HeheheSorting (IOI15_sorting)C++14
0 / 100
1 ms384 KiB
#include<bits/stdc++.h> //:3 using namespace std; typedef long long ll; #define all(a) (a).begin(), (a).end() #define ff first #define ss second #define pb push_back #define mp make_pair #define rc(s) return cout<<s,0 #define pi pair <int, int> #define sz(x) (int)((x).size()) #include "sorting.h" const int dx[] = {0, 1, 0, -1}; const int dy[] = {1, 0, -1, 0}; const ll H = 2e5 + 11; const ll mod = 1e9 + 9; const ll INF64 = 3e18 + 1; const double eps = 1e-14; const double PI = acos(-1); //ifstream in(".in"); //ofstream out(".out"); int pos[H]; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int n = N, m = M; if(n == 1)return 0; if(n == 2){ if(S[0] > S[1]){ P[0] = 0; Q[0] = 1; return 1; }else return 0; } for(int i = 0; i < n; i++){ pos[S[i]] = i; } vector<pi>ans; /* for(int i = 0; i < n; i++){ if(S[i] == i)continue; ans.push_back({i, pos[i]}); int x = S[i], y = S[pos[i]]; swap(S[i], S[pos[i]]); pos[y] = i; pos[x] = x; } int k = 0; for(auto it : ans){ P[k] = it.ff; Q[k] = it.ss; k++; } */ return sz(ans); }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:30:16: warning: unused variable 'm' [-Wunused-variable]
     int n = N, m = M;
                ^
sorting.cpp:28:48: warning: unused parameter 'X' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                ^
sorting.cpp:28:57: warning: unused parameter 'Y' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...