結果

問題 No.675 ドットちゃんたち
ユーザー aaaaaa
提出日時 2018-08-08 16:00:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,215 bytes
コンパイル時間 1,345 ms
コンパイル使用メモリ 99,152 KB
実行使用メモリ 8,076 KB
最終ジャッジ日時 2023-10-24 05:54:17
合計ジャッジ時間 3,435 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,368 KB
testcase_01 AC 2 ms
4,368 KB
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 2 ms
4,368 KB
testcase_04 AC 2 ms
4,368 KB
testcase_05 AC 162 ms
8,012 KB
testcase_06 AC 194 ms
8,012 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>

using namespace std;

int main() {
	int i, j, k;
	int n;
	long x, y;
	vector<pair<long, long>>c, d;


	cin >> n >> x >> y;

	for (i = 0; i < n; i++) {
		long num;

		cin >> num;

		if (num == 1 || num == 2) {
			long num2;

			cin >> num2;
			c.push_back(make_pair(num, num2));
		}
		else {
			c.push_back(make_pair(num, -1));
		}
		
	}

	int four = 4;
	long xx = x, yy = y;

	for (i = n - 1; i >= 0; i--) {

		if (c[i].first == 3) {
			//if (four % 4 == 0) {
				if (xx > 0) {
					if (yy > 0) {
						d.push_back(make_pair(yy, -xx));
						four++;
						long swp = xx;
						xx = yy;
						yy = -swp;
					}
					else if (yy <= 0) {
						//d.push_back(make_pair(-yy, -xx));
						d.push_back(make_pair(yy, -xx));
						four++;
						long swp = xx;
						xx = yy;
						yy = -swp;
					}
				}
				else if (xx <= 0) {
					if (yy > 0) {
						//d.push_back(make_pair(yy, xx));
						d.push_back(make_pair(yy, abs(xx) ));
						four++;
						long swp = abs( xx );
						xx = yy;
						yy = swp;
					}
					else if (yy <= 0) {
						//d.push_back(make_pair(-yy, xx));
						d.push_back(make_pair(yy, abs(xx)));
						four++;
						long swp = abs(xx);
						xx = yy;
						yy = swp;
					}
				}
			
			//}

		}
		else if (c[i].first == 1) {
			if (four % 4 == 1) {
				yy -= c[i].second;
			}
			else if (four % 4 == 2) {
				xx -= c[i].second;
			}
			else if (four % 4 == 3) {
				yy += c[i].second;
			}
			else if (four % 4 == 0) {
				xx += c[i].second;
			}

			d.push_back(make_pair( xx, yy));
		}
		else if (c[i].first == 2) {
			if (four % 4 == 1) {
				xx += c[i].second;
			}
			else if (four % 4 == 2) {
				yy -= c[i].second;
			}
			else if (four % 4 == 3) {
				xx -= c[i].second;
			}
			else if (four % 4 == 0) {
				yy += c[i].second;
			}

			d.push_back(make_pair(xx, yy));
		}

	}

	for (i = n - 1; i >= 0; i--) {
		cout << d[i].first << " " << d[i].second << endl;
	}









	getchar();
	getchar();
	return 0;
}
0