結果

問題 No.471 直列回転機
ユーザー pekempey
提出日時 2016-12-21 00:31:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 299 ms / 3,141 ms
コード長 1,204 bytes
コンパイル時間 1,756 ms
コンパイル使用メモリ 171,028 KB
実行使用メモリ 25,808 KB
平均クエリ数 19588.39
最終ジャッジ日時 2024-06-11 10:20:24
合計ジャッジ時間 12,419 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 58
権限があれば一括ダウンロードができます

ソースコード

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