結果

問題 No.471 直列回転機
ユーザー くれちーくれちー
提出日時 2016-12-21 23:53:16
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,077 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 24,728 KB
実行使用メモリ 24,312 KB
平均クエリ数 9096.70
最終ジャッジ日時 2023-09-23 12:17:33
合計ジャッジ時間 16,096 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,580 KB
testcase_01 AC 24 ms
23,568 KB
testcase_02 RE -
testcase_03 AC 26 ms
24,300 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 23 ms
23,748 KB
testcase_07 AC 25 ms
23,964 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 273 ms
23,472 KB
testcase_13 AC 282 ms
23,568 KB
testcase_14 RE -
testcase_15 AC 334 ms
24,168 KB
testcase_16 RE -
testcase_17 AC 22 ms
23,568 KB
testcase_18 AC 24 ms
23,760 KB
testcase_19 AC 24 ms
23,928 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 258 ms
23,316 KB
testcase_24 AC 164 ms
23,340 KB
testcase_25 AC 73 ms
23,544 KB
testcase_26 RE -
testcase_27 AC 163 ms
23,340 KB
testcase_28 RE -
testcase_29 AC 208 ms
23,952 KB
testcase_30 RE -
testcase_31 AC 318 ms
23,328 KB
testcase_32 AC 253 ms
23,460 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 137 ms
23,352 KB
testcase_37 RE -
testcase_38 AC 79 ms
23,568 KB
testcase_39 RE -
testcase_40 AC 224 ms
23,976 KB
testcase_41 AC 333 ms
23,340 KB
testcase_42 AC 195 ms
23,940 KB
testcase_43 RE -
testcase_44 AC 58 ms
23,580 KB
testcase_45 AC 197 ms
23,448 KB
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 AC 133 ms
23,292 KB
testcase_52 AC 27 ms
24,216 KB
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 AC 81 ms
23,292 KB
testcase_57 AC 71 ms
23,448 KB
testcase_58 AC 39 ms
23,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#define rep(i, n) for (i = 0; i < n; i++)
#define min(a, b) (a < b ? a : b)

int main() {
	int m;
	scanf("%d", &m);
	
	static int x[50000], y[50000];
	int i;	
	rep(i, m) scanf("%d %d", &x[i], &y[i]);

	int x_[2], y_[2];

	rep(i, min(m, 2)) {
		printf("? %d %d\n", x[i], y[i]);
		fflush(stdout);
		scanf("%d %d", &x_[i], &y_[i]);
	}
	if (m <= 2) {
		puts("!");
		rep(i, min(m, 2)) printf("%d %d\n", x_[i], y_[i]);
		return 0;
	}

	int dx = x[1] - x[0];
	int dy = y[1] - y[0];	
	int dx_ = x_[1] - x_[0];
	int dy_ = y_[1] - y_[0];

	puts("!");

	rep(i, m) {
		int tx, ty;
		if ((dx == dx_) && (dy == dy_)) {
			tx = x_[0] + (x[i] - x[0]);
			ty = y_[0] + (y[i] - y[0]);
		}
		else if ((dx == -dx_) && (dy == -dy_)) {
			tx = x_[0] - (x[i] - x[0]);
			ty = y_[0] - (y[i] - y[0]);
		}
		else if ((dx == dy_) && (dy == dx_)) {
			tx = x_[0] + (y[i] - y[0]);
			ty = y_[0] + (x[i] - x[0]);
		}
		else if ((dx == -dy_) && (dy == -dx_)) {
			tx = x_[0] - (y[i] - y[0]);
			ty = y_[0] - (x[i] - x[0]);
		}
		else return 1;
		printf("%d %d\n", tx, ty);
	}

	return 0;
}
0