結果

問題 No.471 直列回転機
ユーザー PachicobuePachicobue
提出日時 2017-03-26 20:46:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 480 ms / 3,141 ms
コード長 2,221 bytes
コンパイル時間 4,020 ms
コンパイル使用メモリ 71,500 KB
実行使用メモリ 24,420 KB
平均クエリ数 19589.39
最終ジャッジ日時 2023-09-02 03:56:04
合計ジャッジ時間 16,501 ms
ジャッジサーバーID
(参考情報)
judge16 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,424 KB
testcase_01 AC 25 ms
24,024 KB
testcase_02 AC 24 ms
24,240 KB
testcase_03 AC 23 ms
23,640 KB
testcase_04 AC 24 ms
23,628 KB
testcase_05 AC 26 ms
23,232 KB
testcase_06 AC 25 ms
23,508 KB
testcase_07 AC 26 ms
24,300 KB
testcase_08 AC 63 ms
23,808 KB
testcase_09 AC 66 ms
24,036 KB
testcase_10 AC 45 ms
24,240 KB
testcase_11 AC 192 ms
23,628 KB
testcase_12 AC 385 ms
23,844 KB
testcase_13 AC 410 ms
23,652 KB
testcase_14 AC 436 ms
24,420 KB
testcase_15 AC 480 ms
24,324 KB
testcase_16 AC 27 ms
23,400 KB
testcase_17 AC 24 ms
23,412 KB
testcase_18 AC 23 ms
23,652 KB
testcase_19 AC 26 ms
24,036 KB
testcase_20 AC 457 ms
24,276 KB
testcase_21 AC 106 ms
23,376 KB
testcase_22 AC 388 ms
23,412 KB
testcase_23 AC 383 ms
24,420 KB
testcase_24 AC 223 ms
23,400 KB
testcase_25 AC 90 ms
23,364 KB
testcase_26 AC 447 ms
23,628 KB
testcase_27 AC 218 ms
24,312 KB
testcase_28 AC 252 ms
24,228 KB
testcase_29 AC 296 ms
23,412 KB
testcase_30 AC 124 ms
23,664 KB
testcase_31 AC 454 ms
24,000 KB
testcase_32 AC 375 ms
24,264 KB
testcase_33 AC 288 ms
24,024 KB
testcase_34 AC 442 ms
23,832 KB
testcase_35 AC 110 ms
23,376 KB
testcase_36 AC 185 ms
23,628 KB
testcase_37 AC 62 ms
24,336 KB
testcase_38 AC 96 ms
24,000 KB
testcase_39 AC 155 ms
23,364 KB
testcase_40 AC 314 ms
23,400 KB
testcase_41 AC 455 ms
24,024 KB
testcase_42 AC 298 ms
23,508 KB
testcase_43 AC 413 ms
23,352 KB
testcase_44 AC 59 ms
23,400 KB
testcase_45 AC 281 ms
24,264 KB
testcase_46 AC 330 ms
23,532 KB
testcase_47 AC 415 ms
23,400 KB
testcase_48 AC 353 ms
24,348 KB
testcase_49 AC 344 ms
24,372 KB
testcase_50 AC 415 ms
24,300 KB
testcase_51 AC 174 ms
23,376 KB
testcase_52 AC 26 ms
23,364 KB
testcase_53 AC 28 ms
23,376 KB
testcase_54 AC 27 ms
23,376 KB
testcase_55 AC 118 ms
23,376 KB
testcase_56 AC 95 ms
23,424 KB
testcase_57 AC 70 ms
23,832 KB
testcase_58 AC 42 ms
23,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// clang-format off
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>
#include <queue>

#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 rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)

#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define pii pair<int, int>
#define vi vector<int>

using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T>& p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T>& vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
constexpr ll MOD = 1000000007;

int M;
constexpr int MAX = 50000;
pii pos[MAX];

pii ask(const pii& p)
{
    cout << "? " << p.fst << " " << p.snd << endl;
    int x,y;
    cin >> x >> y;
    return mp(x,y);
}

pii operator+(const pii& p1, const pii& p2)
{
    return mp(p1.fst+p2.fst, p1.snd+p2.snd);
}

pii operator-(const pii& p1, const pii& p2)
{
    return mp(p1.fst-p2.fst, p1.snd-p2.snd);
}

pii rotate(int flag, const pii& p)
{
    if(flag == 0){
        return p;
    } else if (flag == 1){
        return mp(-p.snd, p.fst);
    } else if (flag == 2){
        return mp(-p.fst, -p.snd);
    } else {
        return mp(p.snd, -p.fst);
    }
}

int main()
{
    cin >> M;
    rep(i, M){
        int x ,y;
        cin >> x >> y;
        pos[i] = mp(x,y);
    }

    const pii p1 = ask(mp(0,0));
    const pii p2 = ask(mp(1,0));
    const pii d = p2-p1;
    cout << d << endl;
    int flag = 0;
    if(d == mp(1,0)){
        flag = 0;
    } else if (d == mp(0,1)) {
        flag = 1;
    } else if (d == mp(-1,0)){
        flag = 2;
    } else {
        flag = 3;
    }

    cout << "!" << endl;
    rep(i, M){
        const pii ans = p1 + rotate(flag, pos[i]);
        cout << ans.fst << " " << ans.snd << endl;
    }

    return 0;
}
0