結果

問題 No.675 ドットちゃんたち
ユーザー hato_gen_tsukihato_gen_tsuki
提出日時 2018-05-09 14:37:41
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,501 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 64,164 KB
実行使用メモリ 18,528 KB
最終ジャッジ日時 2023-09-10 11:19:06
合計ジャッジ時間 2,828 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
18,344 KB
testcase_01 AC 6 ms
18,228 KB
testcase_02 AC 6 ms
18,348 KB
testcase_03 AC 6 ms
18,184 KB
testcase_04 AC 7 ms
18,176 KB
testcase_05 AC 160 ms
18,256 KB
testcase_06 AC 191 ms
18,196 KB
testcase_07 WA -
testcase_08 AC 173 ms
18,212 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <stdio.h>

using namespace std;

int main (){
	long int NNN,PX,PY;
	cin >> NNN >> PX >> PY;
	long int command[100000]={0};
	long int temp;
	for(long int i =0;i<NNN;i++){
		cin >> temp;
		if(temp==1){
			cin >> temp;
			command[i]=100000000+temp;
			temp=0;
		}
		if(temp==2){
			cin >> temp ;
			command[i]=temp;
			temp=0;
		}
		if(temp==3){
			command[i]=-1;
		}
	}
	long int matcom[100000][3][3]={0}; //各コマンドを行列化して格納する
	long int ruicom[100000][3][3]={0}; //行列の積を格納する

	for(long int i=0;i<NNN;i++){
		long int comtemp=0;
		//command Dx
		if(command[i]>9999999){
			comtemp = command[i]-100000000;

			for(long int j=0;j<3;j++){
				for(long 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(long int j=0;j<3;j++){
				for(long 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(long int j=0;j<3;j++){
			for(long int k=0;k<3;k++){
				prlong intf("%d",matcom[i][j][k]);
			}
			prlong intf("\n");

		}
		prlong intf("\n");
		*/

		

	}




	for(long int i =NNN-1;i>-1;i--){
		//i=0は、なにもかけなくていいです
		if(i==NNN-1){
			for(long int j=0;j<3;j++){
				for(long int k=0;k<3;k++){
					ruicom[i][j][k]=matcom[i][j][k];
				}
			}
		}
		else {
			for(long int j=0;j<3;j++){
				for(long int k=0;k<3;k++){
					ruicom[i][j][k]=0;
					for(long int l=0;l<3;l++){
						ruicom[i][j][k] += ruicom[i+1][j][l]*matcom[i][l][k];
					}
				}
			}			
		}
/*
		for(long int j=0;j<3;j++){
			for(long int k=0;k<3;k++){
				prlong intf("%d",ruicom[i][j][k]);
			}
			prlong intf("\n");
		}
		prlong intf("\n");
	
*/	
	}
	long int ansx=0;
	long int ansy=0;
	for(long 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;
}
0