結果
| 問題 |
No.675 ドットちゃんたち
|
| コンテスト | |
| ユーザー |
koyopro
|
| 提出日時 | 2020-01-03 23:22:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,264 bytes |
| コンパイル時間 | 2,090 ms |
| コンパイル使用メモリ | 159,748 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-22 19:48:40 |
| 合計ジャッジ時間 | 3,304 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 3 WA * 5 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define array2(type, x, y) array<array<type, y>, x>
#define vector2(type) vector<vector<type> >
#define out(...) printf(__VA_ARGS__)
int dxy[] = {0, 1, 0, -1, 0};
/*================================*/
int N,X,Y;
struct Order{int c; int v;};
struct Pos {
int x, y;
Pos(){};
Pos(int _x, int _y): x(_x), y(_y){};
Pos operator * (int t) {
return Pos(t * x, t * y);
}
Pos operator + (Pos q) {
return Pos(x + q.x, y + q.y);
}
Pos operator - (Pos q) {
return Pos(x - q.x, y - q.y);
}
int dot(Pos q) {
return x * q.x + y * q.y;
}
int det(Pos q) {
return x * q.y - y * q.x;
}
bool operator == (Pos q) {
return (x == q.x) && (y == q.y);
}
void rotate() {
int tmp = y;
y = -x;
x = tmp;
}
void rotate2() {
int tmp = x;
x = -y;
y = tmp;
}
};
signed main()
{
#if DEBUG
std::ifstream in("input.txt");
std::cin.rdbuf(in.rdbuf());
#endif
cin>>N>>X>>Y;
vector<Order> O(N);
int c=0,v=0;
Pos pos(X, Y);
Pos c1(1, 0);
Pos c2(0, 1);
REP(i,N) {
cin>>c;
if (c<3) cin>>v;
if (c == 1) {
pos = pos + c1 * v;
}
if (c==2) {
pos = pos + c2 * v;
}
if (c==3){
pos.rotate();
c1.rotate();
c2.rotate();
}
O[i].c = c;
O[i].v = v;
}
c1 = c1 * -1;
c2 = c2 * -1;
REP(i,N) {
out("%lld %lld\n", pos.x, pos.y);
auto o = O[i];
if (o.c == 1) {
pos = pos + c1 * o.v;
}
if (o.c==2) {
pos = pos + c2 * o.v;
}
if (o.c==3){
pos.rotate2();
c1.rotate2();
c2.rotate2();
}
}
return 0;
}
koyopro