제출 #1263989

#제출 시각아이디문제언어결과실행 시간메모리
1263989liangjeremy정렬하기 (IOI15_sorting)C++20
0 / 100
3 ms328 KiB
#include "sorting.h"/ #include<bits/stdc++.h> #define fi first #define se second //#define int long long using namespace std; using db=double; using ll=int64_t; using sll=__int128; using lb=long double; int findSwapPairs(int n, int a[], int m, int x[], int y[], int p[], int q[]){ int lst=0; swap(a[x[0]],a[y[0]]); bool one=false; bool zero=false; int pos=1; if(a[0]==0 || a[1]==0)zero=true; if(a[0]==1 || a[1]==1)one=true; if(!one && zero){ int idx=-1; for(int i=2; i<n; i++){ if(a[i]==0)idx=i; } if(a[0]==0){ p[lst]=1; q[lst]=idx; swap(a[1],a[idx]); lst++; }else{ p[lst]=0; q[lst]=idx; swap(a[0],a[idx]); lst++; } }else if(one && !zero){ int idx=-1; for(int i=2; i<n; i++){ if(a[i]==1)idx=i; } if(a[0]==1){ p[lst]=1; q[lst]=idx; swap(a[1],a[idx]); lst++; }else{ p[lst]=0; q[lst]=idx; swap(a[0],a[idx]); lst++; } }else if(!one && !zero){ int idx0=-1; int idx1=-1; for(int i=2; i<n; i++){ if(a[i]==1)idx1=i; else if(a[i]==0)idx0=i; } p[lst]=0; q[lst]=idx0; swap(a[0],a[idx0]); lst++; swap(a[x[1]],a[y[1]]); pos++; p[lst]=0; q[lst]=idx1; swap(a[0],a[idx1]); lst++; } for(int i=2; i<n; i++){ swap(a[p[pos]],a[q[pos]]); pos++; bool ok=true; for(int j=0; j<n; j++){ ok&=(a[j]==j); } if(ok)break; if(a[i]==i)continue; for(int j=i+1; j<n; j++){ if(a[j]==i){ p[lst]=i; q[lst]=j; swap(a[i],a[j]); lst++; break; } } } return lst; }

컴파일 시 표준 에러 (stderr) 메시지

sorting.cpp:1:21: warning: extra tokens at end of #include directive
    1 | #include "sorting.h"/
      |                     ^
#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...