結果

問題 No.471 直列回転機
ユーザー YamyukiYamyuki
提出日時 2016-12-21 14:40:59
言語 C90
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,033 bytes
コンパイル時間 1,086 ms
コンパイル使用メモリ 24,336 KB
実行使用メモリ 35,700 KB
平均クエリ数 0.10
最終ジャッジ日時 2023-09-23 12:13:05
合計ジャッジ時間 5,929 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

void roll(long i,long* xl,long* yl,int r){
	long h,hx=xl[i]-xl[0],hy=yl[i]-yl[0];
	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]=xl[0]+hx;
		yl[i]=yl[0]+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("%d %d",&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("? %ld %ld\n",x[0],y[0]);
		fflush(stdout);
		scanf("%ld %ld",&x1,&y1);
		dx=x1-x[0];
		dy=y1-y[0];
		printf("? %ld %ld\n",x[1],y[1]);
		fflush(stdout);
		scanf("%ld %ld",&x2,&y2);
		x2=x2-x1;
		y2=y2-y1;
		for(i=0;!(x2==x[1]-x[0]) || !(y2==y[1]-y[0]);i++){
			r=x2;
			x2=-y2;
			y2=r;
			
		}
		r=i;
		for(i=1;i<m;i++){
			roll(i,x,y,r);
			x[i]+=dx;
			y[i]+=dy;
		}
		x[0]+=dx;
		y[0]+=dy;
	}
	printf("!\n");
	for(i=0;i<m;i++){
		printf("%ld %ld\n",x[i],y[i]);
	}
	fflush(stdout);
	return 0;
}
0