結果

問題 No.471 直列回転機
ユーザー YamyukiYamyuki
提出日時 2016-12-22 12:27:38
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 334 ms / 3,141 ms
コード長 922 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 24,356 KB
実行使用メモリ 24,288 KB
平均クエリ数 19588.37
最終ジャッジ日時 2023-09-02 03:50:50
合計ジャッジ時間 13,147 ms
ジャッジサーバーID
(参考情報)
judge16 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,400 KB
testcase_01 AC 22 ms
23,508 KB
testcase_02 AC 23 ms
23,652 KB
testcase_03 AC 22 ms
23,688 KB
testcase_04 AC 23 ms
24,024 KB
testcase_05 AC 25 ms
23,892 KB
testcase_06 AC 23 ms
24,180 KB
testcase_07 AC 24 ms
23,700 KB
testcase_08 AC 43 ms
23,892 KB
testcase_09 AC 47 ms
23,508 KB
testcase_10 AC 35 ms
23,508 KB
testcase_11 AC 146 ms
24,240 KB
testcase_12 AC 268 ms
23,412 KB
testcase_13 AC 271 ms
24,192 KB
testcase_14 AC 295 ms
24,288 KB
testcase_15 AC 334 ms
23,712 KB
testcase_16 AC 26 ms
24,180 KB
testcase_17 AC 23 ms
23,400 KB
testcase_18 AC 24 ms
23,892 KB
testcase_19 AC 23 ms
23,712 KB
testcase_20 AC 299 ms
23,892 KB
testcase_21 AC 82 ms
23,364 KB
testcase_22 AC 282 ms
23,904 KB
testcase_23 AC 254 ms
24,276 KB
testcase_24 AC 162 ms
24,192 KB
testcase_25 AC 70 ms
23,820 KB
testcase_26 AC 293 ms
24,036 KB
testcase_27 AC 157 ms
23,652 KB
testcase_28 AC 182 ms
23,280 KB
testcase_29 AC 207 ms
23,904 KB
testcase_30 AC 98 ms
23,412 KB
testcase_31 AC 298 ms
23,484 KB
testcase_32 AC 248 ms
23,508 KB
testcase_33 AC 198 ms
23,628 KB
testcase_34 AC 288 ms
23,520 KB
testcase_35 AC 91 ms
23,280 KB
testcase_36 AC 139 ms
23,820 KB
testcase_37 AC 41 ms
23,820 KB
testcase_38 AC 73 ms
23,532 KB
testcase_39 AC 116 ms
23,484 KB
testcase_40 AC 219 ms
23,364 KB
testcase_41 AC 294 ms
23,508 KB
testcase_42 AC 195 ms
23,412 KB
testcase_43 AC 269 ms
23,844 KB
testcase_44 AC 55 ms
23,400 KB
testcase_45 AC 198 ms
23,364 KB
testcase_46 AC 231 ms
23,520 KB
testcase_47 AC 282 ms
23,640 KB
testcase_48 AC 239 ms
23,484 KB
testcase_49 AC 239 ms
23,364 KB
testcase_50 AC 281 ms
23,820 KB
testcase_51 AC 133 ms
23,880 KB
testcase_52 AC 30 ms
24,168 KB
testcase_53 AC 27 ms
23,400 KB
testcase_54 AC 26 ms
23,688 KB
testcase_55 AC 94 ms
23,904 KB
testcase_56 AC 85 ms
23,688 KB
testcase_57 AC 59 ms
23,508 KB
testcase_58 AC 34 ms
23,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
long x[50000],y[50000];

void roll(long i,long* xl,long* yl,int r){
	long h,hx=xl[i],hy=yl[i];
	switch(r){
		case 3:
		h=hy;
		hy=hx;
		hx=-h;
		case 2:
		h=hy;
		hy=hx;
		hx=-h;
		case 1:
		h=hy;
		hy=hx;
		hx=-h;
		case 0:
		xl[i]=hx;
		yl[i]=hy;
		return;
	}
}
int main(){
	long m,i,dx,dy,x1,x2,y1,y2;
	int r;
	scanf("%ld",&m);
	for(i=0;i<m;i++){
		scanf("%ld %ld",&x[i],&y[i]);
	}
	if(m==1){
		printf("? %d %d\n",x[0],y[0]);
		fflush(stdout);
		scanf("%ld %ld",&x[0],&y[0]);
	}else{
		printf("? 0 0\n");
		fflush(stdout);
		scanf("%ld %ld",&x1,&y1);
		printf("? 1 0\n");
		fflush(stdout);
		scanf("%ld %ld",&x2,&y2);
		x2=x2-x1;
		y2=y2-y1;
		if(y2==0){
			if(x2==1) r=0;
			else r=2;
		}else{
			if(y2==1) r=1;
			else r=3;
		}
		for(i=0;i<m;i++){
			roll(i,x,y,r);
			x[i]+=x1;
			y[i]+=y1;
		}
	}
	printf("!\n");
	for(i=0;i<m;i++){
		printf("%ld %ld\n",x[i],y[i]);
	}
	fflush(stdout);
	return 0;
}
0