Submission #73428

#TimeUsernameProblemLanguageResultExecution timeMemory
73428SmsSAncient Books (IOI17_books)C++14
50 / 100
201 ms8432 KiB
#include<bits/stdc++.h> using namespace std; #define for2(a,b,c) for(int a = b; a < c; a++) #include "books.h" #define ll long long long long minimum_walk(std::vector<int> p, int s) { if(s != 0) return 0; ll res = 0; int n = p.size(); for2(i,0,n) res += abs(i-p[i]); int r = 0; while(n > 0){ if(p[n-1] == n-1) n--; else break; } for2(i,0,n-1){ r = max(r,p[i]); if(i == r) res += 2; } return res; }
#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...