結果
| 問題 |
No.471 直列回転機
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2015-07-31 00:43:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 464 ms / 3,141 ms |
| コード長 | 2,325 bytes |
| コンパイル時間 | 1,134 ms |
| コンパイル使用メモリ | 105,960 KB |
| 実行使用メモリ | 25,336 KB |
| 平均クエリ数 | 19588.39 |
| 最終ジャッジ日時 | 2024-06-11 10:12:23 |
| 合計ジャッジ時間 | 16,680 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 58 |
コンパイルメッセージ
main.cpp: In member function ‘val val::operator=(const val&)’:
main.cpp:56:9: warning: no return statement in function returning non-void [-Wreturn-type]
56 | }
| ^
ソースコード
#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;
}
koyumeishi