結果

問題 No.675 ドットちゃんたち
ユーザー LaylaLayla
提出日時 2018-06-13 23:47:10
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,294 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 26,892 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-13 04:01:07
合計ジャッジ時間 4,520 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

typedef struct dot {
    int x;
    int y;
} Dot;

int main() {
    int dot_num = 0;
    int initial_x, initial_y;
    scanf("%d%d%d", &dot_num, &initial_x, &initial_y);
    Dot dots[dot_num];
    int command[dot_num][2];
    for (int i = 0; i < dot_num; ++i) {
        dots[i].x = initial_x;
        dots[i].y = initial_y;
    }

    for (int j = 0; j < dot_num; ++j) {
        scanf("%d", &command[j][0]);
        if (command[j][0] == 3) {
            continue;
        }
        scanf("%d", &command[j][1]);
    }

    for (int k = 0; k < dot_num; ++k) {
        for (int i = k; i < dot_num; ++i) {
            switch (command[i][0]) {
                case 1:
                    dots[k].x += command[i][1];
                    break;
                case 2:
                    dots[k].y += command[i][1];
                    break;
                case 3: {
                    int temp = dots[k].x;
                    dots[k].x = dots[k].y;
                    dots[k].y = -temp;
                    break;
                }
                default:
                    printf("invalid value\n");
                    break;
            }
        }
    }

    for (int l = 0; l < dot_num; ++l) {
        printf("%d %d\n", dots[l].x, dots[l].y);
    }


    return 0;
}
0