Submission #892313

# Submission time Handle Problem Language Result Execution time Memory
892313 2023-12-25T07:19:40 Z abcvuitunggio Ancient Books (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;
}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -