제출 #1085420

#제출 시각아이디문제언어결과실행 시간메모리
1085420guagua0407정렬하기 (IOI15_sorting)C++17
16 / 100
1 ms604 KiB
#include "sorting.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,m; vector<int> p; vector<int> x,y; vector<pair<int,int>> vec; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { if(N==1) return 0; n=N; m=M; p.resize(n); x.resize(m); y.resize(m); for(int i=0;i<n;i++){ p[i]=S[i]; } for(int i=0;i<m;i++){ x[i]=X[i]; y[i]=Y[i]; } for(int i=0;i<m;i++){ P[i]=0; Q[i]=0; } int cnt=0; for(int i=2;i<n;i++){ if(p[i]==0){ if(y[0]==1) swap(p[0],p[1]); swap(p[0],p[i]); P[cnt]=0; Q[cnt]=i; cnt++; break; } } for(int i=2;i<n;i++){ if(p[i]==1){ if(y[0]==1) swap(p[0],p[1]); if(p[0]!=0) swap(p[0],p[i]),P[cnt]=0; else swap(p[1],p[i]),P[cnt]=1; Q[cnt]=i; cnt++; break; } } for(int i=2;i<n;i++){ for(int j=i+1;j<n;j++){ if(p[j]==i){ if(y[0]==1) swap(p[0],p[1]); swap(p[i],p[j]); P[cnt]=i; Q[cnt]=j; cnt++; break; } } } return (p[0]==0 or y[0]==0?cnt:cnt+1); }
#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...