답안 #923224

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
923224 2024-02-07T01:10:19 Z AdamGS Choreography (IOI23_choreography) C++17
59 / 100
69 ms 9036 KB
#include "choreography.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7;
int P[LIM], Q[LIM], n, a, b, inv;
vector<int>A, B;
void init(int N, vector<int>_P) {
  n=N;
  rep(i, n) P[i]=_P[i];
  rep(i, n) Q[P[i]]=i;
}
void move_right(int k) {
  if(!inv) a=(a+k)%n;
  else b=(b+k)%n;
}
void move_left(int k) {
  move_right((n-k)%n);
}
void swap_places() {
  if(!inv) {
    if(A.size() && A.back()==a%2) A.pop_back();
    else A.pb(a%2);
  } else {
    if(B.size() && B.back()==b%2) B.pop_back();
    else B.pb(b%2);
  }
}
void move_around() {
  inv^=1;
}
int get_position(int d) {
  if(!inv) {
    int z=d, p=B.size()%n;
    if(B.size() && z%2==B[0]) z=(z+p)%n; else z=(z-p+n)%n;
    z=(z-b+n)%n;
    int x=Q[z];
    p=A.size()%n;
    if(A.size() && x%2==A[0]) x=(x+p)%n; else x=(x-p+n)%n;
    return (x+a)%n;
  }
  int z=d, p=A.size()%n;
  if(A.size() && z%2==A[0]) z=(z+p)%n; else z=(z-p+n)%n;
  z=(z-a+n)%n;
  int x=P[z];
  p=B.size()%n;
  if(B.size() && x%2==B[0]) x=(x+p)%n; else x=(x-p+n)%n;
  return (x+b)%n;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 6344 KB Output is correct
2 Correct 67 ms 6320 KB Output is correct
3 Correct 66 ms 6372 KB Output is correct
4 Correct 66 ms 6344 KB Output is correct
5 Correct 43 ms 4572 KB Output is correct
6 Correct 45 ms 4560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 27th lines differ - on the 1st token, expected: '452', found: '312'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 6360 KB Output is correct
2 Correct 69 ms 8520 KB Output is correct
3 Correct 60 ms 8668 KB Output is correct
4 Correct 39 ms 6088 KB Output is correct
5 Correct 37 ms 6088 KB Output is correct
6 Correct 37 ms 6088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 6360 KB Output is correct
2 Correct 69 ms 8520 KB Output is correct
3 Correct 60 ms 8668 KB Output is correct
4 Correct 39 ms 6088 KB Output is correct
5 Correct 37 ms 6088 KB Output is correct
6 Correct 37 ms 6088 KB Output is correct
7 Correct 64 ms 8500 KB Output is correct
8 Correct 62 ms 8644 KB Output is correct
9 Correct 61 ms 8560 KB Output is correct
10 Correct 37 ms 6008 KB Output is correct
11 Correct 37 ms 6048 KB Output is correct
12 Correct 37 ms 5908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 6344 KB Output is correct
2 Correct 67 ms 6320 KB Output is correct
3 Correct 66 ms 6372 KB Output is correct
4 Correct 66 ms 6344 KB Output is correct
5 Correct 43 ms 4572 KB Output is correct
6 Correct 45 ms 4560 KB Output is correct
7 Correct 59 ms 6360 KB Output is correct
8 Correct 69 ms 8520 KB Output is correct
9 Correct 60 ms 8668 KB Output is correct
10 Correct 39 ms 6088 KB Output is correct
11 Correct 37 ms 6088 KB Output is correct
12 Correct 37 ms 6088 KB Output is correct
13 Correct 66 ms 9036 KB Output is correct
14 Correct 65 ms 9000 KB Output is correct
15 Correct 66 ms 8900 KB Output is correct
16 Correct 42 ms 6352 KB Output is correct
17 Correct 42 ms 6344 KB Output is correct
18 Correct 44 ms 6348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 6344 KB Output is correct
2 Correct 67 ms 6320 KB Output is correct
3 Correct 66 ms 6372 KB Output is correct
4 Correct 66 ms 6344 KB Output is correct
5 Correct 43 ms 4572 KB Output is correct
6 Correct 45 ms 4560 KB Output is correct
7 Incorrect 1 ms 344 KB 27th lines differ - on the 1st token, expected: '452', found: '312'
8 Halted 0 ms 0 KB -