結果
| 問題 | No.675 ドットちゃんたち |
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2018-04-14 00:14:14 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,276 bytes |
| 記録 | |
| コンパイル時間 | 975 ms |
| コンパイル使用メモリ | 81,228 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-26 22:00:14 |
| 合計ジャッジ時間 | 1,847 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 3 WA * 5 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
struct P {
int x, y, r;
};
void rot(int& x, int& y, int r) {
if (r == 0) {
return;
} else if (r == 1) {
int t = x; x = -y; y = t;
} else if (r == 2) {
x = -x; y = -y;
} else if (r == 3) {
int t = x; x = y; y = -t;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, px, py;
cin >> n >> px >> py;
vector<P> p(n + 1);
p[0] = { 0, 0, 0 };
int x = 0, y = 0, r = 0;
for (int i = 0; i < n; i++) {
int c;
cin >> c;
if (c != 3) {
int d[2] = {};
cin >> d[c == 2];
rot(d[0], d[1], r);
x += d[0];
y += d[1];
} else {
r = (r + 3) % 4;
}
p[i + 1] = { x, y, r };
}
for (int i = 0; i < n; i++) {
int dx = p[n].x - p[i].x, dy = p[n].y - p[i].y, dr = (p[n].r - p[i].r + 4) % 4;
int dr2 = (4 - dr) % 4;
rot(dx, dy, dr);
int x = px, y = py;
rot(x, y, dr);
cout << x + dx << ' ' << y + dy << '\n';
}
return 0;
}
merom686