제출 #836163

#제출 시각아이디문제언어결과실행 시간메모리
836163DenkataArranging Shoes (IOI19_shoes)C++14
10 / 100
1 ms1876 KiB
#include<bits/stdc++.h> #include "shoes.h" //#include "grader.cpp" using namespace std; const int maxn = 1e5+3; long long i,j,ans,p,pos[maxn*2]; long long count_swaps(vector<int> s) { ans = 0; memset(pos,-1,sizeof(pos)); j = 1; for(auto i:s) { if(pos[-i+maxn]==-1) pos[i+maxn] = j; else { p = pos[-i+maxn]; ans+=j-p-1; if(i<0) ans++; pos[-i+maxn] = -1; } j++; } return ans; }
#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...