Submission #923225

# Submission time Handle Problem Language Result Execution time Memory
923225 2024-02-07T01:15:05 Z AdamGS Choreography (IOI23_choreography) C++17
45 / 100
73 ms 6432 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)%n; else z=(z+p)%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)%n; else z=(z+p)%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;
}
# Verdict Execution time Memory Grader output
1 Correct 67 ms 6344 KB Output is correct
2 Correct 65 ms 6360 KB Output is correct
3 Correct 73 ms 6384 KB Output is correct
4 Correct 65 ms 6380 KB Output is correct
5 Correct 42 ms 4552 KB Output is correct
6 Correct 43 ms 4556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 6th lines differ - on the 1st token, expected: '386', found: '424'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 6340 KB Output is correct
2 Correct 61 ms 6192 KB Output is correct
3 Correct 61 ms 6236 KB Output is correct
4 Correct 36 ms 4552 KB Output is correct
5 Correct 36 ms 4800 KB Output is correct
6 Correct 37 ms 4620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 6340 KB Output is correct
2 Correct 61 ms 6192 KB Output is correct
3 Correct 61 ms 6236 KB Output is correct
4 Correct 36 ms 4552 KB Output is correct
5 Correct 36 ms 4800 KB Output is correct
6 Correct 37 ms 4620 KB Output is correct
7 Incorrect 60 ms 6340 KB 3rd lines differ - on the 1st token, expected: '74726', found: '95884'
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 67 ms 6344 KB Output is correct
2 Correct 65 ms 6360 KB Output is correct
3 Correct 73 ms 6384 KB Output is correct
4 Correct 65 ms 6380 KB Output is correct
5 Correct 42 ms 4552 KB Output is correct
6 Correct 43 ms 4556 KB Output is correct
7 Correct 58 ms 6340 KB Output is correct
8 Correct 61 ms 6192 KB Output is correct
9 Correct 61 ms 6236 KB Output is correct
10 Correct 36 ms 4552 KB Output is correct
11 Correct 36 ms 4800 KB Output is correct
12 Correct 37 ms 4620 KB Output is correct
13 Correct 64 ms 6360 KB Output is correct
14 Correct 64 ms 6356 KB Output is correct
15 Correct 67 ms 6432 KB Output is correct
16 Correct 41 ms 4560 KB Output is correct
17 Correct 41 ms 4572 KB Output is correct
18 Correct 42 ms 4556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 6344 KB Output is correct
2 Correct 65 ms 6360 KB Output is correct
3 Correct 73 ms 6384 KB Output is correct
4 Correct 65 ms 6380 KB Output is correct
5 Correct 42 ms 4552 KB Output is correct
6 Correct 43 ms 4556 KB Output is correct
7 Incorrect 1 ms 348 KB 6th lines differ - on the 1st token, expected: '386', found: '424'
8 Halted 0 ms 0 KB -