답안 #422988

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
422988 2021-06-10T15:19:41 Z MDario 고대 책들 (IOI17_books) C++11
0 / 100
1 ms 204 KB
#include "books.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
long long minimum_walk(vector<int> p, int s){
    int n=p.size(), r=0, x=0, y=0;
    bool b[n];
    for(int i=0; i<n; i++)b[i]=0;
    for(int i=0; i<n; i++){
        if(!b[i]){
            r+=2*(i-x);
            x=i;
            r+=p[i]-i;
            y=p[i];
            while(y!=i){
                b[y]=1;
                r+=abs(p[y]-y);
                y=p[y];
            }
            b[y]=1;
        }
    }
	return r;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '3304', found: '4736'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -