제출 #282456

#제출 시각아이디문제언어결과실행 시간메모리
282456Ruba_KArranging Shoes (IOI19_shoes)C++14
50 / 100
1094 ms3200 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std ; long long count_swaps(vector<int> v) { int n = v.size() ; long long ans = 0 ; for(;!v.empty();){ int i = v.size() - 1; int idx = i - 1 ; while(v[idx] != v[i] * -1){ idx -- ; ans ++ ; } v.erase(v.begin() + idx); if(v[i] < 0)ans ++ ; v.pop_back(); } return ans; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:6:9: warning: unused variable 'n' [-Wunused-variable]
    6 |     int n = v.size() ;
      |         ^
#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...