답안 #892313

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892313 2023-12-25T07:19:40 Z abcvuitunggio 고대 책들 (IOI17_books) C++17
0 / 100
0 ms 444 KB
#include "books.h"
#include <bits/stdc++.h>
using namespace std;
int vis[1000001];
long long minimum_walk(vector <int> p, int s){
    int x=0,n=p.size();
    long long d=0;
    for (int i=0;i<n;i++){
        if (!vis[i]){
            x=i;
            while (true){
                vis[x]=1;
                d+=abs(x-p[x]);
                x=p[x];
                if (x==i)
                    break;
            }
        }
    }
    return x*2+d;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 444 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 444 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 444 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB 3rd lines differ - on the 1st token, expected: '3304', found: '4736'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 444 KB 3rd lines differ - on the 1st token, expected: '6', found: '8'
3 Halted 0 ms 0 KB -