Codeforces Round #691 DIV1 C問題 (1500pt)
Codeforces Round #691 DIV2 E問題 (2500pt)
Problem description
省略
省略
C++に変換後のコードはこちら
//no-unlocked
int N, Q, A[1000][1000], tmp[1000][1000], arr[1000];
char S[1d5+2];
void do_move(int x, int y){
rep(i,N) rep(j,N) tmp[i][j] = A[i][j];
rep(i,N) rep(j,N) A[i][j] = tmp[(i-x)%%N][(j-y)%%N];
}
void do_rot_x(void){
rep(j,N){
rep(i,N) arr[A[i][j]] = i;
rep(i,N) A[i][j] = arr[i];
}
}
void do_rot_y(void){
rep(i,N){
rep(j,N) arr[A[i][j]] = j;
rep(j,N) A[i][j] = arr[j];
}
}
{
REP(rd_int()){
int x[6] = {}, y[6] = {}, cur = 0;
rd(N,Q,(A--)(N,N),S);
rep(q,Q){
if(S[q] == 'R') y[cur]++;
if(S[q] == 'L') y[cur]--;
if(S[q] == 'D') x[cur]++;
if(S[q] == 'U') x[cur]--;
if(S[q] == 'I') cur = (cur + if[cur%2, -1, 1]) %% 6;
if(S[q] == 'C') cur = (cur + if[cur%2, 1, -1]) %% 6;
}
rep(i,6){
do_move(x[i], y[i]);
if[i%2==0, do_rot_y(), do_rot_x()];
}
rep(i,cur){
if[i%2==0, do_rot_y(), do_rot_x()];
}
wt(A(N,N)+1);
}
}
Current time: 2023年05月30日10時08分43秒
Last modified: 2020年12月30日09時55分45秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF691 CF_DIV1_C CF_DIV2_E
トップページに戻る
Logged in as: unknown user (not login)