제출 #411993

#제출 시각아이디문제언어결과실행 시간메모리
411993dolijanArranging Shoes (IOI19_shoes)C++14
50 / 100
582 ms1048580 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long cnt=0; void resi(int l,int r,int n,std::vector<int> s) { if(s.empty()) return; int prva=s[l]; for(int i=l+1;i<=r;i++) { if(s[i]==(prva*(-1))) { if(prva<0) { cnt+=(i-(l+1)); s.erase(s.begin()+i); s.erase(s.begin()); } else { cnt+=(i-l); s.erase(s.begin()+i); s.erase(s.begin()); } break; } } n-=2; resi(0,n-1,n,s); } long long count_swaps(std::vector<int> s) { int n=s.size(); int l=0; int r=n-1; resi(l,r,n,s); return cnt; }
#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...