제출 #132312

#제출 시각아이디문제언어결과실행 시간메모리
132312MoNsTeR_CuBe고대 책들 (IOI17_books)C++17
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; long long minimum_walk(std::vector<int> p, int s) { #define int long long vector< pair<int, int> > v; for(int i = 0; i < (int)p.size(); i++){ v.push_back(make_pair(p[i], i)); } sort(v.begin(), v.end()); int last = s; int tot = 0; for(int i = 0; i < (int)v.size(); i++){ tot += abs(last - v[i].second); tot += abs(v[i].first-v[i].second); last = v[i].first; } tot += abs(last - s); return tot; #undef int }
#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...