답안 #51506

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
51506 2018-06-18T04:44:04 Z aome 고대 책들 (IOI17_books) C++17
0 / 100
3 ms 752 KB
#include <bits/stdc++.h>
#include "books.h"

using namespace std;

const int N = 1000005;

bool visit[N];

long long minimum_walk(vector<int> p, int s) {
	assert(s == 0);
	int n = p.size();
	int cur = 0;
	long long sum = 0;
	for (int i = 0; i < n; ++i) sum += abs(p[i] - i);
	while (1) {
		queue<int> qu;
		visit[cur] = 1, qu.push(cur);

		while (qu.size()) {
			int u = qu.front(); qu.pop();
			while (cur < p[u]) {
				cur++, visit[cur] = 1, qu.push(cur);
			}
		}

		if (cur == n - 1) break;
		sum += 2, cur++;
	}
	return sum;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Incorrect 2 ms 584 KB 3rd lines differ - on the 1st token, expected: '4', found: '6'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Incorrect 2 ms 584 KB 3rd lines differ - on the 1st token, expected: '4', found: '6'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Incorrect 2 ms 584 KB 3rd lines differ - on the 1st token, expected: '4', found: '6'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 752 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Incorrect 2 ms 584 KB 3rd lines differ - on the 1st token, expected: '4', found: '6'
6 Halted 0 ms 0 KB -