Submission #923226

# Submission time Handle Problem Language Result Execution time Memory
923226 2024-02-07T01:19:55 Z AdamGS Choreography (IOI23_choreography) C++17
59 / 100
82 ms 6596 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;
    z=(z-b+n)%n;
    if(B.size() && z%2==B[0]) z=(z+p)%n; else z=(z-p+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;
  z=(z-a+n)%n;
  if(A.size() && z%2==A[0]) z=(z+p)%n; else z=(z-p+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 66 ms 6376 KB Output is correct
2 Correct 66 ms 6348 KB Output is correct
3 Correct 71 ms 6360 KB Output is correct
4 Correct 66 ms 6424 KB Output is correct
5 Correct 43 ms 4572 KB Output is correct
6 Correct 43 ms 4600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 30th lines differ - on the 1st token, expected: '54', found: '128'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 60 ms 6344 KB Output is correct
2 Correct 68 ms 6216 KB Output is correct
3 Correct 59 ms 6344 KB Output is correct
4 Correct 36 ms 4564 KB Output is correct
5 Correct 36 ms 4552 KB Output is correct
6 Correct 37 ms 4552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 6344 KB Output is correct
2 Correct 68 ms 6216 KB Output is correct
3 Correct 59 ms 6344 KB Output is correct
4 Correct 36 ms 4564 KB Output is correct
5 Correct 36 ms 4552 KB Output is correct
6 Correct 37 ms 4552 KB Output is correct
7 Correct 82 ms 6344 KB Output is correct
8 Correct 68 ms 6356 KB Output is correct
9 Correct 63 ms 6596 KB Output is correct
10 Correct 37 ms 4552 KB Output is correct
11 Correct 37 ms 4520 KB Output is correct
12 Correct 37 ms 4552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 6376 KB Output is correct
2 Correct 66 ms 6348 KB Output is correct
3 Correct 71 ms 6360 KB Output is correct
4 Correct 66 ms 6424 KB Output is correct
5 Correct 43 ms 4572 KB Output is correct
6 Correct 43 ms 4600 KB Output is correct
7 Correct 60 ms 6344 KB Output is correct
8 Correct 68 ms 6216 KB Output is correct
9 Correct 59 ms 6344 KB Output is correct
10 Correct 36 ms 4564 KB Output is correct
11 Correct 36 ms 4552 KB Output is correct
12 Correct 37 ms 4552 KB Output is correct
13 Correct 67 ms 6340 KB Output is correct
14 Correct 64 ms 6360 KB Output is correct
15 Correct 64 ms 6348 KB Output is correct
16 Correct 42 ms 4552 KB Output is correct
17 Correct 43 ms 4564 KB Output is correct
18 Correct 49 ms 4540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 6376 KB Output is correct
2 Correct 66 ms 6348 KB Output is correct
3 Correct 71 ms 6360 KB Output is correct
4 Correct 66 ms 6424 KB Output is correct
5 Correct 43 ms 4572 KB Output is correct
6 Correct 43 ms 4600 KB Output is correct
7 Incorrect 1 ms 348 KB 30th lines differ - on the 1st token, expected: '54', found: '128'
8 Halted 0 ms 0 KB -