제출 #959433

#제출 시각아이디문제언어결과실행 시간메모리
959433NemanjaSo2005Arranging Shoes (IOI19_shoes)C++17
10 / 100
1067 ms3924 KiB
#include "shoes.h" #include<bits/stdc++.h> #define ll long long using namespace std; const int maxn=2e5+5; int N,niz[maxn]; ll res=0; int prvalev(){ for(int i=1;i<=N;i++) if(niz[i]<0) return i; } int parod(int x){ for(int i=1;i<=N;i++) if(niz[i]==-x) return i; } void zamena(int y,int x){ for(int i=y;i>x;i--){ res++; swap(niz[i],niz[i-1]); } } ll count_swaps(vector<int> s) { N=s.size(); for(int i=0;i<N;i++) niz[i+1]=s[i]; for(int i=1;i<=N;i+=2){ int pl=prvalev(); zamena(pl,i); int pd=parod(niz[i]); // cout<<pl<<" "<<pd<<endl; zamena(pd,i+1); niz[i]=niz[i+1]=0; } return res; }

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

shoes.cpp: In function 'int prvalev()':
shoes.cpp:12:1: warning: control reaches end of non-void function [-Wreturn-type]
   12 | }
      | ^
shoes.cpp: In function 'int parod(int)':
shoes.cpp:17:1: warning: control reaches end of non-void function [-Wreturn-type]
   17 | }
      | ^
#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...