Submission #839549

# Submission time Handle Problem Language Result Execution time Memory
839549 2023-08-30T08:58:58 Z model_code Choreography (IOI23_choreography) C++17
45 / 100
82 ms 6272 KB
// correct/solution-subtask5.cpp

#include "choreography.h"
#include <vector>

int x = 0, j = 0, n;
bool s = false;
std::vector<int> p, inv;

void init(int N, std::vector<int> P){
	n = N;
	p = P;
	inv.resize(N);
	for(int i = 0; i < N; i++){
		inv[P[i]] = i;
	}
}

void move_right(int K){
    x += K;
	if(x >= n) x -= n;
}

void move_left(int K){
	move_right(n - K);
}

void swap_places() {}

void move_around(){
	s = !s;
	std::swap(x, j);
}

int get_position(int D){
	int i = D - j;
	if(i < 0) i += n;
	int ans = s ? p[i] + x : inv[i] + x; 
	return ans < n ? ans : ans - n;
}
# Verdict Execution time Memory Grader output
1 Correct 67 ms 6184 KB Output is correct
2 Correct 66 ms 6216 KB Output is correct
3 Correct 66 ms 6200 KB Output is correct
4 Correct 76 ms 6212 KB Output is correct
5 Correct 42 ms 4420 KB Output is correct
6 Correct 45 ms 4420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 5th lines differ - on the 1st token, expected: '411', found: '410'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 82 ms 6204 KB Output is correct
2 Correct 78 ms 6208 KB Output is correct
3 Correct 59 ms 6272 KB Output is correct
4 Correct 36 ms 4404 KB Output is correct
5 Correct 35 ms 4420 KB Output is correct
6 Correct 34 ms 4420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 6204 KB Output is correct
2 Correct 78 ms 6208 KB Output is correct
3 Correct 59 ms 6272 KB Output is correct
4 Correct 36 ms 4404 KB Output is correct
5 Correct 35 ms 4420 KB Output is correct
6 Correct 34 ms 4420 KB Output is correct
7 Incorrect 59 ms 6164 KB 3rd lines differ - on the 1st token, expected: '74726', found: '64493'
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 67 ms 6184 KB Output is correct
2 Correct 66 ms 6216 KB Output is correct
3 Correct 66 ms 6200 KB Output is correct
4 Correct 76 ms 6212 KB Output is correct
5 Correct 42 ms 4420 KB Output is correct
6 Correct 45 ms 4420 KB Output is correct
7 Correct 82 ms 6204 KB Output is correct
8 Correct 78 ms 6208 KB Output is correct
9 Correct 59 ms 6272 KB Output is correct
10 Correct 36 ms 4404 KB Output is correct
11 Correct 35 ms 4420 KB Output is correct
12 Correct 34 ms 4420 KB Output is correct
13 Correct 68 ms 6252 KB Output is correct
14 Correct 65 ms 6176 KB Output is correct
15 Correct 67 ms 6208 KB Output is correct
16 Correct 41 ms 4428 KB Output is correct
17 Correct 46 ms 4420 KB Output is correct
18 Correct 43 ms 4420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 6184 KB Output is correct
2 Correct 66 ms 6216 KB Output is correct
3 Correct 66 ms 6200 KB Output is correct
4 Correct 76 ms 6212 KB Output is correct
5 Correct 42 ms 4420 KB Output is correct
6 Correct 45 ms 4420 KB Output is correct
7 Incorrect 1 ms 212 KB 5th lines differ - on the 1st token, expected: '411', found: '410'
8 Halted 0 ms 0 KB -