제출 #1083209

#제출 시각아이디문제언어결과실행 시간메모리
1083209Malix정렬하기 (IOI15_sorting)C++14
20 / 100
1 ms348 KiB
#include "sorting.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef pair<int,int> pi; typedef vector<pi> pii; typedef tuple<int,int,int> tii; typedef vector<ll> li; typedef vector<li> lii; #define REP(i,a,b) for(int i=a;i<b;i++) #define F first #define S second #define PB push_back #define LSOne(s) ((s)&(-s)) ll INF=1000000000000000010; int inf=1e9+10; ll M=1e9+7; int findSwapPairs(int n, int S[], int M, int X[], int Y[], int P[], int Q[]) { vi a(n),b(n); if(n==1)return 0; int ans=0; REP(i,0,n)a[S[i]]=i; REP(i,0,n)b[i]=S[i]; int pos=0; for(int i=n-1;i>=0;i--){ if(Y[0]==1){ swap(b[a[0]],b[a[1]]); swap(a[0],a[1]); if(i==0&&a[i]==i){ ans++; P[pos]=0; Q[pos]=0; break; } } if(a[i]==i)continue; ans++; P[pos]=i; Q[pos]=a[i]; pos++; swap(b[i],b[a[i]]); int x=b[a[i]]; int y=a[i]; a[i]=i; a[x]=y; } return ans; }

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

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:24:39: warning: declaration of 'M' shadows a global declaration [-Wshadow]
   24 | int findSwapPairs(int n, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                   ~~~~^
sorting.cpp:22:4: note: shadowed declaration is here
   22 | ll M=1e9+7;
      |    ^
sorting.cpp:24:39: warning: unused parameter 'M' [-Wunused-parameter]
   24 | int findSwapPairs(int n, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                   ~~~~^
sorting.cpp:24:46: warning: unused parameter 'X' [-Wunused-parameter]
   24 | 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...