結果
| 問題 |
No.675 ドットちゃんたち
|
| コンテスト | |
| ユーザー |
aaa
|
| 提出日時 | 2018-08-08 16:00:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,215 bytes |
| コンパイル時間 | 1,119 ms |
| コンパイル使用メモリ | 100,392 KB |
| 実行使用メモリ | 7,888 KB |
| 最終ジャッジ日時 | 2024-09-22 22:44:04 |
| 合計ジャッジ時間 | 3,695 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 3 WA * 5 |
ソースコード
#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;
}
aaa