Submission #914076

#TimeUsernameProblemLanguageResultExecution timeMemory
914076nightfalAncient Books (IOI17_books)C++14
50 / 100
82 ms15740 KiB
#include <cstdio> #include <vector> #include <cassert> #include <cstdlib> using namespace std; bool isSubtask3(int s) { return s==0;} long long subtask3(vector<int> p, int s) { int n = p.size(), last = 0; long long total = 0; for(int i=0; i<n; i++) { if (i==p[i]) continue; if(i>last) total += (i-last)*2; total += abs(p[i]-i); last = max(last,p[i]); } return total; } long long fulltask(vector<int> p, int s) { return 0; } long long minimum_walk(std::vector<int> p, int s) { if (isSubtask3(s)) return subtask3(p,s); return fulltask(p,s); }
#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...