# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72690 | 2018-08-26T15:21:20 Z | mhnd | Ancient Books (IOI17_books) | C++14 | 3 ms | 496 KB |
#include "books.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 2e5+50; const int oo = 1e9; const int mod = 1e9+7; ll minimum_walk(vector<int> p, int s) { ll ans = 0; int mx=-1; for(int i=0;i<p.size();i++){ ans += abs(i-p[i]); mx = max(mx,p[i]); if(mx==i)ans+=2; } for(int i=0;i<s;i++){ if(p[i]!=i)continue; ans-=2; } for(int i=p.size()-1;i>s;i--){ if(p[i]!=i)continue; ans-=2; } return ans - 2; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 496 KB | 3rd lines differ - on the 1st token, expected: '6', found: '4' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 496 KB | 3rd lines differ - on the 1st token, expected: '6', found: '4' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 496 KB | 3rd lines differ - on the 1st token, expected: '6', found: '4' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 496 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '1664' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 496 KB | 3rd lines differ - on the 1st token, expected: '6', found: '4' |
3 | Halted | 0 ms | 0 KB | - |