結果

問題 No.471 直列回転機
ユーザー maimai
提出日時 2016-12-21 02:11:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,612 bytes
コンパイル時間 1,450 ms
コンパイル使用メモリ 165,028 KB
実行使用メモリ 24,576 KB
平均クエリ数 5.00
最終ジャッジ日時 2023-09-23 12:08:11
合計ジャッジ時間 22,435 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
typedef unsigned int uint;
typedef long long int ll;
typedef unsigned long long int ull;

#define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl;
#define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;}
#define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;
#define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;}
#define debugaar(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[y][x]<<" ";}cout<<endl;}
#define ALL(v) (v).begin(),(v).end()
#define BIGINT 0x7FFFFFFF
#define E107 1000000007ll
void printbit(int u){if(u==0)cout<<0;else{int s=0,k=0;for(;0<u;u>>=1,k++)s=(s<<1)|(u&1);for(;0<k--;s>>=1)cout<<(s&1);}}

#define TIME chrono::system_clock::now()
#define MILLISEC(t) (chrono::duration_cast<chrono::milliseconds>(t).count())

template<typename T1,typename T2>
ostream& operator <<(ostream &o,const pair<T1,T2> p){o<<"("<<p.first<<":"<<p.second<<")";return o;}

struct point{
    int x,y;
    point():x(0),y(0){}
    point(int xx,int yy):x(xx),y(yy){}
};

int width,height;
int m,n;

point data[101010];

void query(const point& from,point& to){
    cout << "? " << from.x << " " << from.y << endl;
    scanf("%d%d",&(to.x),&(to.y));
}

void rotate(point& p,const int cnt){
    if (cnt<=0) return;
    int t=p.y;
    p.y = -p.x;
    p.x = t;
    rotate(p,cnt-1);
}

int main(){
    int i,j,k;
    int x,y,a,b;
    
    cin >> m;
    
    for (i=0;i<m;i++){
        scanf("%d%d",&(data[i].x),&(data[i].y));
    }
    
    point p1(0,0),p2(0,1),p3(1,1),p4(1,0);
    
    query(p1,p1);
    query(p2,p2);
    query(p3,p3);
    query(p4,p4);
    
    int rc = 0;
    point offset,zoom;
    if (p1.x<p3.x && p1.y>p3.y){
        rc =1; // rotate 1
        offset = p1;
        zoom.x = p2.x-p4.x;
        zoom.y = p2.y-p4.y;
    }else if (p1.x>p3.x && p1.y>p3.y){
        rc =2;
        offset = p1;
        zoom.x = p1.x-p3.x;
        zoom.y = p1.y-p3.y;
    }else if (p1.x>p3.x && p1.y<p3.y){
        rc =3;
        offset = p1;
        zoom.x = p4.x-p2.x;
        zoom.y = p4.y-p2.y;
    }else{
        offset = p1;
        zoom.x = p3.x-p1.x;
        zoom.y = p3.y-p1.y;
    }
    
    printf("! ");
    for (i=0;i<m;i++){
        rotate(data[i],rc);
        printf("%d %d ",offset.x + data[i].x*zoom.x,offset.y + data[i].y*zoom.y);
    }
    cout << endl;cout.flush();

    return 0;
}
0