結果

問題 No.675 ドットちゃんたち
コンテスト
ユーザー 王源成
提出日時 2025-10-22 21:26:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 1,954 ms
コンパイル使用メモリ 195,008 KB
実行使用メモリ 7,724 KB
最終ジャッジ日時 2025-10-22 21:26:16
合計ジャッジ時間 3,741 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,px,py;
int ansx[N],ansy[N];
int id[N],d[N];
signed main(){
	//freopen("createmove.in","r",stdin);
	//freopen("createmove.out","w",stdout); 
	cin>>n>>px>>py;
	for(int i=1;i<=n;i++){
		cin>>id[i];
		if(id[i]<=2) cin>>d[i];
	} 
	int x=px,y=py,c=0;
	for(int i=n;i>=1;i--){
		if(id[i]==3){
			swap(x,y);
			y=-y;
			c=(c+1)%4;
		}
		else{
			int t;
			if(id[i]==1) t=0;
			else t=3;
			t=(t+c)%4;
			if(t==0) x+=d[i];
			else if(t==1) y-=d[i];
			else if(t==2) x-=d[i];
			else y+=d[i];
		}
		ansx[i]=x;ansy[i]=y;
	}
	for(int i=1;i<=n;i++) cout<<ansx[i]<<" "<<ansy[i]<<'\n';
	return 0;
}
0