結果

問題 No.471 直列回転機
ユーザー koyumeishikoyumeishi
提出日時 2015-07-31 00:43:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 464 ms / 3,141 ms
コード長 2,325 bytes
コンパイル時間 2,604 ms
コンパイル使用メモリ 102,632 KB
実行使用メモリ 24,408 KB
平均クエリ数 19588.39
最終ジャッジ日時 2023-09-02 03:33:40
合計ジャッジ時間 20,053 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,312 KB
testcase_01 AC 23 ms
24,396 KB
testcase_02 AC 22 ms
23,640 KB
testcase_03 AC 22 ms
23,796 KB
testcase_04 AC 22 ms
24,300 KB
testcase_05 AC 23 ms
23,544 KB
testcase_06 AC 22 ms
23,616 KB
testcase_07 AC 23 ms
24,228 KB
testcase_08 AC 56 ms
23,616 KB
testcase_09 AC 57 ms
24,012 KB
testcase_10 AC 35 ms
24,348 KB
testcase_11 AC 183 ms
24,024 KB
testcase_12 AC 369 ms
24,408 KB
testcase_13 AC 388 ms
23,364 KB
testcase_14 AC 420 ms
23,388 KB
testcase_15 AC 377 ms
23,520 KB
testcase_16 AC 25 ms
23,412 KB
testcase_17 AC 22 ms
24,048 KB
testcase_18 AC 22 ms
24,060 KB
testcase_19 AC 22 ms
23,532 KB
testcase_20 AC 427 ms
23,364 KB
testcase_21 AC 94 ms
24,228 KB
testcase_22 AC 361 ms
23,412 KB
testcase_23 AC 367 ms
24,024 KB
testcase_24 AC 216 ms
23,664 KB
testcase_25 AC 80 ms
23,652 KB
testcase_26 AC 455 ms
24,012 KB
testcase_27 AC 205 ms
23,832 KB
testcase_28 AC 245 ms
23,532 KB
testcase_29 AC 269 ms
23,640 KB
testcase_30 AC 119 ms
23,988 KB
testcase_31 AC 464 ms
23,388 KB
testcase_32 AC 356 ms
23,640 KB
testcase_33 AC 285 ms
23,988 KB
testcase_34 AC 416 ms
23,400 KB
testcase_35 AC 106 ms
23,532 KB
testcase_36 AC 178 ms
23,628 KB
testcase_37 AC 47 ms
24,036 KB
testcase_38 AC 94 ms
23,640 KB
testcase_39 AC 140 ms
23,412 KB
testcase_40 AC 301 ms
23,544 KB
testcase_41 AC 449 ms
23,976 KB
testcase_42 AC 274 ms
24,192 KB
testcase_43 AC 400 ms
23,400 KB
testcase_44 AC 59 ms
24,312 KB
testcase_45 AC 257 ms
24,300 KB
testcase_46 AC 313 ms
23,832 KB
testcase_47 AC 421 ms
23,400 KB
testcase_48 AC 345 ms
23,616 KB
testcase_49 AC 331 ms
23,400 KB
testcase_50 AC 387 ms
23,604 KB
testcase_51 AC 157 ms
24,240 KB
testcase_52 AC 25 ms
23,664 KB
testcase_53 AC 26 ms
23,796 KB
testcase_54 AC 27 ms
23,520 KB
testcase_55 AC 113 ms
24,012 KB
testcase_56 AC 96 ms
23,652 KB
testcase_57 AC 66 ms
23,616 KB
testcase_58 AC 43 ms
23,532 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In member function ‘val val::operator=(const val&)’:
main.cpp:56:2: warning: no return statement in function returning non-void [-Wreturn-type]
  }
  ^

ソースコード

diff #

#include <complex>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <functional>
#include <random>
#include <ctime>
#include "assert.h"

using namespace std;

pair<long long,long long> operator * (const int& r, const pair<long long,long long>& p){
	pair<long long, long long> ret = (r&1)?pair<long long,long long>{-p.second, p.first}:p;
	if(r&2) ret = {-ret.first, -ret.second};
	return ret;
}

pair<long long, long long> operator + (const pair<long long, long long>& y, const pair<long long, long long>& x){
	pair<long long, long long> ret = y;
	ret.first += x.first;
	ret.second += x.second;
	return ret;
}

pair<long long, long long> operator - (const pair<long long, long long>& y, const pair<long long, long long>& x){
	pair<long long, long long> ret = y;
	ret.first -= x.first;
	ret.second -= x.second;
	return ret;
}

struct val{
	int rot;
	pair<long long, long long> con;

	val() : rot(0), con({0,0}){
	}

	val(const int r_, const pair<long long, long long>& o ) : rot(r_){
		con = o - rot * o;
	}

	val(const val& x) : rot(x.rot), con(x.con){
	}

	val operator = (const val& x){
		rot = x.rot;
		con = x.con;
	}

	val operator * (const val& x){
		val ret;
		ret.rot = (rot + x.rot) & 0b11;
		ret.con = x.rot * con + x.con;
		return ret;
	}

	pair<long long, long long> operator () (const pair<long long, long long>& v){
		pair<long long, long long> ret = rot * v + con;
		return ret;
	}

};

ostream& operator << (ostream& os, const pair<long long,long long>& x){
	os << x.first << " " << x.second;
	return os;
}

int main(int argc, char* argv[]){
	int m;
	cin >> m;
	vector<pair<long long, long long>> p(m);
	for(int i=0; i<m; i++){
		cin >> p[i].first >> p[i].second;
	}

	pair<long long, long long> a,b;
	a = {0,0};
	b = {1,0};

	pair<long long, long long> a_,b_;
	cout << "? " << a << endl;
	cin >> a_.first >> a_.second;
	
	cout << "? " << b << endl;
	cin >> b_.first >> b_.second;

	val f;
	pair<long long, long long> v = b_ - a_;
	
	map<pair<long long, long long>, int> r;
	r[{ 1, 0}] = 0;
	r[{ 0, 1}] = 1;
	r[{-1, 0}] = 2;
	r[{ 0,-1}] = 3;
	f.rot = r[v];
	f.con = a_ - f(a);
	cout << "!" << endl;
	for(int i=0; i<m; i++){
		cout << f(p[i]) << endl;
	}

	return 0;
}
0