結果

問題 No.471 直列回転機
ユーザー koyoprokoyopro
提出日時 2020-02-04 03:06:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 343 ms / 3,141 ms
コード長 1,581 bytes
コンパイル時間 2,393 ms
コンパイル使用メモリ 144,172 KB
実行使用メモリ 24,348 KB
平均クエリ数 19589.39
最終ジャッジ日時 2023-09-02 04:02:16
合計ジャッジ時間 15,431 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
24,168 KB
testcase_01 AC 26 ms
23,544 KB
testcase_02 AC 26 ms
23,340 KB
testcase_03 AC 28 ms
24,204 KB
testcase_04 AC 26 ms
23,496 KB
testcase_05 AC 30 ms
24,228 KB
testcase_06 AC 29 ms
23,976 KB
testcase_07 AC 27 ms
23,964 KB
testcase_08 AC 50 ms
23,388 KB
testcase_09 AC 54 ms
23,556 KB
testcase_10 AC 39 ms
23,772 KB
testcase_11 AC 158 ms
24,324 KB
testcase_12 AC 280 ms
23,976 KB
testcase_13 AC 287 ms
23,760 KB
testcase_14 AC 311 ms
23,340 KB
testcase_15 AC 343 ms
23,448 KB
testcase_16 AC 30 ms
23,964 KB
testcase_17 AC 29 ms
23,292 KB
testcase_18 AC 29 ms
23,940 KB
testcase_19 AC 27 ms
23,328 KB
testcase_20 AC 323 ms
24,348 KB
testcase_21 AC 88 ms
23,352 KB
testcase_22 AC 293 ms
23,484 KB
testcase_23 AC 264 ms
23,748 KB
testcase_24 AC 175 ms
23,580 KB
testcase_25 AC 75 ms
23,292 KB
testcase_26 AC 313 ms
23,988 KB
testcase_27 AC 162 ms
24,252 KB
testcase_28 AC 188 ms
23,760 KB
testcase_29 AC 220 ms
23,952 KB
testcase_30 AC 109 ms
24,216 KB
testcase_31 AC 319 ms
23,748 KB
testcase_32 AC 267 ms
23,544 KB
testcase_33 AC 211 ms
23,784 KB
testcase_34 AC 307 ms
23,292 KB
testcase_35 AC 95 ms
23,568 KB
testcase_36 AC 146 ms
23,748 KB
testcase_37 AC 50 ms
24,228 KB
testcase_38 AC 77 ms
23,316 KB
testcase_39 AC 127 ms
23,292 KB
testcase_40 AC 236 ms
23,544 KB
testcase_41 AC 328 ms
23,604 KB
testcase_42 AC 215 ms
23,568 KB
testcase_43 AC 294 ms
23,952 KB
testcase_44 AC 60 ms
23,448 KB
testcase_45 AC 194 ms
23,568 KB
testcase_46 AC 239 ms
24,216 KB
testcase_47 AC 289 ms
23,448 KB
testcase_48 AC 262 ms
24,192 KB
testcase_49 AC 252 ms
23,616 KB
testcase_50 AC 302 ms
23,340 KB
testcase_51 AC 142 ms
23,508 KB
testcase_52 AC 29 ms
23,760 KB
testcase_53 AC 31 ms
23,328 KB
testcase_54 AC 29 ms
24,132 KB
testcase_55 AC 99 ms
23,976 KB
testcase_56 AC 93 ms
23,568 KB
testcase_57 AC 74 ms
23,952 KB
testcase_58 AC 42 ms
23,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define array2(type, x, y) array<array<type, y>, x>
#define vector2(type) vector<vector<type> >
#define out(...) printf(__VA_ARGS__)

int dxy[] = {0, 1, 0, -1, 0};

void solve();
signed main()
{
//#if DEBUG
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());
//#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 123450
#endif

int N,M,Q;
int P[123450][2];

void query(int x, int y, int *x0, int *y0) {
    out("? %lld %lld\n", x, y);
    fflush(stdout);
    cin >> *x0 >> *y0;
}

void solve() {
    cin>>M;
    REP(i,M) {
        cin>>P[i][0]>>P[i][1];
    }
    
    int x0,y0,x1,y1,x2,y2;
    query(0, 0, &x0, &y0);
    query(1, 0, &x1, &y1);
    query(0, 1, &x2, &y2);
    
    /*
     |xn| |a b c||x|
     |yn|=|d e f||y|
     | 1| |0 0 1||1|
     */
    int a,b,c,d,e,f;
    c = x0;
    a = x1 - x0;
    b = x2 - x0;
    f = y0;
    d = y1 - y0;
    e = y2 - y0;
    cout << "!" << endl;
    REP(i,M) {
        int x = a*P[i][0] + b*P[i][1]+c;
        int y = d*P[i][0] + e*P[i][1]+f;
        out("%lld %lld\n",x,y);
    }
}
0