답안 #853938

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
853938 2023-09-25T14:53:46 Z JooDdae Choreography (IOI23_choreography) C++17
10 / 100
67 ms 6972 KB
#include "choreography.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

struct dancer {
    vector<int> v;
    ll p[2], f[2];
    int o, s;

    dancer() {}
    dancer(vector<int> P) : v(P), p{0, 0}, f{0, 1}, o(0), s(0) {}
} A, B;

void init(int N, vector<int> P) {
    A = dancer(P);
    vector<int> R(N);
    for(int i=0;i<N;i++) R[P[i]] = i;
    B = dancer(R);
    return;
} 

void move_right(int K) {
    for(int i=0;i<2;i++) A.f[i] -= (K + (i != A.s))/2*2;
    if(K % 2) A.s = !A.s, A.o = !A.o;

    B.p[0] += K, B.p[1] += K;
    if(K % 2) B.o = !B.o, B.s = !B.s;

    return;
}

void move_left(int K) {
    for(int i=0;i<2;i++) A.f[i] += (K + (i == A.s))/2*2;
    if(K % 2) A.s = !A.s, A.o = !A.o;

    B.p[0] -= K, B.p[1] -= K;
    if(K % 2) B.o = !B.o, B.s = !B.s;

    return;
}

void swap_places() {
    A.s = !A.s, A.o = !A.o;
    
    B.p[B.o]++, B.p[!B.o]--;
    B.o = !B.o, B.s = !B.s;

    return;
}

void move_around() {
    swap(A, B);
    return;
}

int get_position(int D){
    int N = A.v.size();

    int b = (D & 1) ^ B.s;
    int u = (B.f[b]%N + D/2*2 + N) % N;
    return (B.v[u] + B.p[u % 2]%N + N) % N;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 67 ms 6684 KB 3rd lines differ - on the 1st token, expected: '63867', found: '34653'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 5th lines differ - on the 1st token, expected: '411', found: '55'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 6636 KB Output is correct
2 Correct 62 ms 6460 KB Output is correct
3 Correct 65 ms 6972 KB Output is correct
4 Correct 37 ms 4924 KB Output is correct
5 Correct 38 ms 4924 KB Output is correct
6 Correct 42 ms 4940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 6636 KB Output is correct
2 Correct 62 ms 6460 KB Output is correct
3 Correct 65 ms 6972 KB Output is correct
4 Correct 37 ms 4924 KB Output is correct
5 Correct 38 ms 4924 KB Output is correct
6 Correct 42 ms 4940 KB Output is correct
7 Incorrect 60 ms 6472 KB 3rd lines differ - on the 1st token, expected: '74726', found: '64492'
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 67 ms 6684 KB 3rd lines differ - on the 1st token, expected: '63867', found: '34653'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 67 ms 6684 KB 3rd lines differ - on the 1st token, expected: '63867', found: '34653'
2 Halted 0 ms 0 KB -