結果

問題 No.675 ドットちゃんたち
ユーザー Toshiyuki OikeToshiyuki Oike
提出日時 2018-04-18 12:36:00
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 971 bytes
コンパイル時間 1,408 ms
コンパイル使用メモリ 52,124 KB
実行使用メモリ 8,452 KB
最終ジャッジ日時 2023-09-09 11:21:20
合計ジャッジ時間 6,143 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "iostream"

#define MAX_N 100000

using namespace std;

int N, Px, Py;

pair<int, int> dots[MAX_N];

int main() {

    cin >> N >> Px >> Py;

    for (int i = 0; i < N; i++) {
        int command;

        cin >> command;

        dots[i].first = Px;
        dots[i].second = Py;

        if (command == 1) {
            int dx;
            cin >> dx;

            for (int j = 0; j <= i; j++) {
                dots[j].first += dx;
            }
        } else if (command == 2) {
            int dy;
            cin >> dy;

            for (int j = 0; j <= i; j++) {
                dots[j].second += dy;
            }
        } else {
            
            for (int j = 0; j <= i; j++) {
                int tmp = dots[j].first;
                dots[j].first = dots[j].second;
                dots[j].second = tmp * -1;
            }
        }
    }

    for (int i = 0; i < N; i++) {
        cout << dots[i].first << " " << dots[i].second << endl;
    }
}
0