結果

問題 No.471 直列回転機
ユーザー pekempeypekempey
提出日時 2016-12-21 00:31:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 317 ms / 3,141 ms
コード長 1,204 bytes
コンパイル時間 1,643 ms
コンパイル使用メモリ 169,780 KB
実行使用メモリ 24,408 KB
平均クエリ数 19588.39
最終ジャッジ日時 2023-09-02 03:39:22
合計ジャッジ時間 13,261 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,364 KB
testcase_01 AC 22 ms
23,412 KB
testcase_02 AC 23 ms
23,376 KB
testcase_03 AC 23 ms
24,408 KB
testcase_04 AC 24 ms
24,228 KB
testcase_05 AC 24 ms
24,036 KB
testcase_06 AC 24 ms
24,048 KB
testcase_07 AC 23 ms
24,024 KB
testcase_08 AC 40 ms
23,364 KB
testcase_09 AC 48 ms
24,000 KB
testcase_10 AC 31 ms
23,664 KB
testcase_11 AC 143 ms
23,652 KB
testcase_12 AC 249 ms
24,264 KB
testcase_13 AC 257 ms
24,036 KB
testcase_14 AC 278 ms
23,664 KB
testcase_15 AC 317 ms
24,012 KB
testcase_16 AC 25 ms
23,364 KB
testcase_17 AC 23 ms
24,300 KB
testcase_18 AC 23 ms
23,808 KB
testcase_19 AC 22 ms
23,376 KB
testcase_20 AC 290 ms
24,036 KB
testcase_21 AC 88 ms
23,652 KB
testcase_22 AC 266 ms
24,036 KB
testcase_23 AC 243 ms
23,808 KB
testcase_24 AC 159 ms
23,520 KB
testcase_25 AC 67 ms
23,616 KB
testcase_26 AC 298 ms
24,312 KB
testcase_27 AC 152 ms
23,412 KB
testcase_28 AC 170 ms
23,532 KB
testcase_29 AC 191 ms
23,520 KB
testcase_30 AC 94 ms
23,844 KB
testcase_31 AC 301 ms
23,508 KB
testcase_32 AC 254 ms
23,400 KB
testcase_33 AC 191 ms
23,532 KB
testcase_34 AC 286 ms
23,856 KB
testcase_35 AC 85 ms
23,412 KB
testcase_36 AC 139 ms
24,036 KB
testcase_37 AC 42 ms
24,036 KB
testcase_38 AC 73 ms
24,300 KB
testcase_39 AC 112 ms
23,832 KB
testcase_40 AC 212 ms
24,048 KB
testcase_41 AC 296 ms
24,228 KB
testcase_42 AC 199 ms
23,364 KB
testcase_43 AC 260 ms
23,988 KB
testcase_44 AC 57 ms
23,364 KB
testcase_45 AC 193 ms
23,532 KB
testcase_46 AC 214 ms
23,376 KB
testcase_47 AC 265 ms
23,520 KB
testcase_48 AC 233 ms
23,988 KB
testcase_49 AC 224 ms
23,376 KB
testcase_50 AC 259 ms
23,640 KB
testcase_51 AC 126 ms
23,424 KB
testcase_52 AC 26 ms
23,616 KB
testcase_53 AC 25 ms
24,312 KB
testcase_54 AC 26 ms
24,324 KB
testcase_55 AC 92 ms
24,372 KB
testcase_56 AC 78 ms
23,412 KB
testcase_57 AC 63 ms
23,400 KB
testcase_58 AC 36 ms
24,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef complex<double> C;

uint64_t xorshift() {
    static uint64_t x = time(NULL);
    x ^= x << 13;
    x ^= x >> 7;
    x ^= x << 17;
    return x;
}

complex<double> query(int x, int y) {
    int xx, yy;
    scanf("%d %d", &xx, &yy);
    return C(xx, yy);
}

complex<double> query2(int x, int y) {
    int xx = -y;
    int yy = x;
    xx -= 1;
    yy -= 1;
    x = -yy;
    y = xx;
    x += 1;
    y += 1;
    return C(x, y);
}

int main() {
    int n;
    cin >> n;

    vector<C> ps(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        ps[i] = C(x, y);
    }

    vector<C> a;
    vector<C> b;

    for (int i = 0; i < 2; i++) {
        int x = xorshift() % 20001 - 10000;
        int y = xorshift() % 20001 - 10000;
        printf("? %d %d\n", x, y);
        fflush(stdout);
        a.emplace_back(x, y);
        b.emplace_back(query(x, y));
    }

    C A = (b[1] - b[0]) / (a[1] - a[0]);
    C B = b[0] - a[0] * A;

    printf("!\n");
    for (int i = 0; i < n; i++) {
        C ans = ps[i] * A + B;
        printf("%d %d\n", (int)round(ans.real()), (int)round(ans.imag()));
    }
    fflush(stdout);
}
0