結果
問題 | No.471 直列回転機 |
ユーザー |
|
提出日時 | 2017-06-11 12:57:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 482 ms / 3,141 ms |
コード長 | 2,942 bytes |
コンパイル時間 | 1,051 ms |
コンパイル使用メモリ | 102,896 KB |
実行使用メモリ | 25,448 KB |
平均クエリ数 | 19589.39 |
最終ジャッジ日時 | 2024-06-11 10:40:28 |
合計ジャッジ時間 | 16,868 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 58 |
ソースコード
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> using namespace std; template <class T1> class Operators { public: template <class T2> const T1 operator+(const T2& right) const{ T1 ans = static_cast<const T1&>( *this ); ans += right; return ans; } template <class T2> const T1 operator-(const T2& right) const{ T1 ans = static_cast<const T1&>( *this ); ans -= right; return ans; } template <class T2> const T1 operator*(const T2& right) const{ T1 ans = static_cast<const T1&>( *this ); ans *= right; return ans; } template <class T2> const T1 operator/(const T2& right) const{ T1 ans = static_cast<const T1&>( *this ); ans /= right; return ans; } bool operator!=(const T1& right) const{ const T1& left = static_cast<const T1&>( *this ); return !(left == right); } }; class Point : public Operators<Point> { public: int y, x; Point(){ y = x = 0; } Point(int y0, int x0){ y = y0; x = x0; } Point& operator+=(const Point& p){ y += p.y; x += p.x; return *this; } Point& operator-=(const Point& p){ y -= p.y; x -= p.x; return *this; } Point& operator*=(int a){ y *= a; x *= a; return *this; } Point& operator/=(int a){ y /= a; x /= a; return *this; } bool operator==(const Point& p) const{ return y == p.y && x == p.x; } long long length2() const{ return y * (long long)y + x * (long long)x; } long long dist2(const Point& p) const{ return (y - p.y) * (long long)(y - p.y) + (x - p.x) * (long long)(x - p.x); } long long dot(const Point& p) const{ return y * (long long)p.y + x * (long long)p.x; // |a|*|b|*cosθ } long long cross(const Point& p) const{ return x * (long long)p.y - y * (long long)p.x; // |a|*|b|*sinθ } }; int main() { int m; cin >> m; vector<Point> p(m); for(int i=0; i<m; ++i) cin >> p[i].x >> p[i].y; Point init, dy, dx; cout << "? 0 0" << endl; cin >> init.x >> init.y; cout << "? 0 1" << endl; cin >> dy.x >> dy.y; dy -= init; cout << "? 1 0" << endl; cin >> dx.x >> dx.y; dx -= init; cout << '!' << endl; for(int i=0; i<m; ++i){ Point p2 = init + dy * p[i].y + dx * p[i].x; cout << p2.x << ' ' << p2.y << endl; } return 0; }