제출 #144522

#제출 시각아이디문제언어결과실행 시간메모리
144522BoxworldArranging Shoes (IOI19_shoes)C++14
50 / 100
1081 ms2684 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long ans=0; vector<int> a; int swapp(int l,int r){ int t=a[r]; for (int i=r;i>l;i--)a[i]=a[i-1]; a[l]=t; } long long count_swaps(vector<int> s){ a=s; int n=s.size(); for (int i=0;i<n;i++) if (i%2==0){ int j; for (j=i+1;;j++) if (a[i]+a[j]==0)break; if (a[i]<0){ swapp(i+1,j); ans+=j-i-1; }else{ swapp(i,j); ans+=j-i; } } return ans; }

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

shoes.cpp: In function 'int swapp(int, int)':
shoes.cpp:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#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...