Submission #70218

# Submission time Handle Problem Language Result Execution time Memory
70218 2018-08-22T13:36:12 Z E869120 Ancient Books (IOI17_books) C++14
0 / 100
3 ms 392 KB
#include "books.h"
#include <bits/stdc++.h>

int n;bool used[1009];

long long minimum_walk(std::vector<int> p, int s) {
	n=p.size();
	int sum=0,L=0;
	for(int i=0;i<n;i++){
		if(used[i]==true) continue;
		int cx=i;L=i;
		while(true){
			sum+=abs(cx-p[cx]);used[cx]=true;
			cx=p[cx];if(cx==i) break;
		}
	}
	return sum+L*2;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Incorrect 2 ms 360 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Incorrect 2 ms 360 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Incorrect 2 ms 360 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 392 KB 3rd lines differ - on the 1st token, expected: '3304', found: '4736'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Incorrect 2 ms 360 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -