# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
776027 | 2023-07-07T08:38:46 Z | peteza | Ancient Books (IOI17_books) | C++14 | 1 ms | 308 KB |
#include <bits/stdc++.h> #include "books.h" using namespace std; int qs[1000005]; long long minimum_walk(std::vector<int> p, int s) { int cur = 0, cv = 0, curcnt = 0; long long cans = 0; for(int i=0;i<=p.size();i++) qs[i] = 0; for(int i=0;i<p.size();i++) { qs[min(i, p[i])]++; qs[max(i, p[i])]--; } for(int i=0;i<p.size();i++) { if(!cv) cur++, curcnt++; else curcnt = 0; cv += qs[i]; cans += cv; } return cans + 2*(cur-curcnt); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '6', found: '8' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '6', found: '8' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '6', found: '8' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 308 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '2746' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '6', found: '8' |
2 | Halted | 0 ms | 0 KB | - |