# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
289060 | 2020-09-02T10:15:04 Z | JoMee | Ancient Books (IOI17_books) | C++17 | 1 ms | 384 KB |
#include "books.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,n) for(int i = a; i<n; i++) #define per(i,a,n) for(int i = n-1; i>=a; i--) long long minimum_walk(vector<int> p, int s) { vector<int> sm(p.size(),0); rep(i,0,p.size()){ if(i < p[i])sm[i]++,sm[p[i]]--; } rep(i,1,sm.size())sm[i] += sm[i-1]; int rm = -1; per(i,0,p.size()){ if(sm[i] != 0){ rm = i; break; } } if(rm == -1)return 0; int res = 0; rep(i,0,rm){ if(sm[i] != 0)res+=sm[i]-1; } res += 2*(rm+1); return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '8', found: '7' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '8', found: '7' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '8', found: '7' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '2371' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '8', found: '7' |
4 | Halted | 0 ms | 0 KB | - |