結果
| 問題 |
No.675 ドットちゃんたち
|
| コンテスト | |
| ユーザー |
hato_gen_tsuki
|
| 提出日時 | 2018-05-09 14:34:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,351 bytes |
| コンパイル時間 | 859 ms |
| コンパイル使用メモリ | 63,160 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-06-28 02:41:49 |
| 合計ジャッジ時間 | 2,950 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 4 WA * 4 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <stdio.h>
using namespace std;
int main (){
int NNN,PX,PY;
cin >> NNN >> PX >> PY;
int command[100000]={0};
int temp;
for(int i =0;i<NNN;i++){
cin >> temp;
if(temp==1){
cin >> temp;
command[i]=1000000+temp;
temp=0;
}
if(temp==2){
cin >> temp ;
command[i]=temp;
temp=0;
}
if(temp==3){
command[i]=-1;
}
}
int matcom[100000][3][3]={0}; //各コマンドを行列化して格納する
int ruicom[100000][3][3]={0}; //行列の積を格納する
for(int i=0;i<NNN;i++){
int comtemp=0;
//command Dx
if(command[i]>999999){
comtemp = command[i]-1000000;
for(int j=0;j<3;j++){
for(int k=0;k<3;k++){
if(j==k){
matcom[i][j][k]=1;
}
else{
matcom[i][j][k]=0;
}
}
}
matcom[i][0][2]=comtemp;
}
//command 90deg
else if(command[i]==-1){
matcom[i][0][0]=0;
matcom[i][0][1]=1;
matcom[i][0][2]=0;
matcom[i][1][0]=-1;
matcom[i][1][1]=0;
matcom[i][1][2]=0;
matcom[i][2][0]=0;
matcom[i][2][1]=0;
matcom[i][2][2]=1;
}
//command Dy
else if(command[i]>0){
for(int j=0;j<3;j++){
for(int k=0;k<3;k++){
if(j==k){
matcom[i][j][k]=1;
}
else{
matcom[i][j][k]=0;
}
}
}
matcom[i][1][2]=command[i];
}
/*
for(int j=0;j<3;j++){
for(int k=0;k<3;k++){
printf("%d",matcom[i][j][k]);
}
printf("\n");
}
printf("\n");
*/
}
for(int i =NNN-1;i>-1;i--){
//i=0は、なにもかけなくていいです
if(i==NNN-1){
for(int j=0;j<3;j++){
for(int k=0;k<3;k++){
ruicom[i][j][k]=matcom[i][j][k];
}
}
}
else {
for(int j=0;j<3;j++){
for(int k=0;k<3;k++){
ruicom[i][j][k]=0;
for(int l=0;l<3;l++){
ruicom[i][j][k] += ruicom[i+1][j][l]*matcom[i][l][k];
}
}
}
}
/*
for(int j=0;j<3;j++){
for(int k=0;k<3;k++){
printf("%d",ruicom[i][j][k]);
}
printf("\n");
}
printf("\n");
*/
}
long int ansx=0;
long int ansy=0;
for(int i=NNN-1;i>-1;i--){
ansx = ruicom[NNN-1-i][0][0] * PX + ruicom[NNN-1-i][0][1]* PY + ruicom[NNN-1-i][0][2] * 1;
ansy = ruicom[NNN-1-i][1][0] * PX + ruicom[NNN-1-i][1][1]* PY + ruicom[NNN-1-i][1][2] * 1;
cout << ansx << " " << ansy << endl;
}
return 0;
}
hato_gen_tsuki