結果

問題 No.471 直列回転機
ユーザー startcpp
提出日時 2016-12-22 11:59:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 489 ms / 3,141 ms
コード長 685 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 54,876 KB
実行使用メモリ 25,592 KB
平均クエリ数 19588.39
最終ジャッジ日時 2024-06-11 10:32:11
合計ジャッジ時間 15,495 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 58
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int m;
int x[50000], y[50000];

int main() {
	int i, j;
	
	cin >> m;
	for (i = 0; i < m; i++) cin >> x[i] >> y[i];
	
	cout << "? 0 0" << endl; cout.flush();
	int a, b;
	cin >> a >> b;
	
	cout << "? 1 0" << endl; cout.flush();
	int c, d;
	cin >> c >> d;
	c -= a;
	d -= b;
	
	int dir;
	if (c == 1 && d == 0) dir = 0;
	if (c == 0 && d == 1) dir = 1;
	if (c == -1 && d == 0) dir = 2;
	if (c == 0 && d == -1) dir = 3;
	
	cout << "!" << endl;
	for (i = 0; i < m; i++) {
		for (j = 0; j < dir; j++) {
			int nx = -y[i];
			int ny = x[i];
			x[i] = nx;
			y[i] = ny;
		}
		x[i] += a;
		y[i] += b;
		cout << x[i] << " " << y[i] << endl;
	}
	return 0;
}
0