結果

問題 No.471 直列回転機
ユーザー PachicobuePachicobue
提出日時 2017-03-26 20:46:26
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 498 ms / 3,141 ms
コード長 2,221 bytes
コンパイル時間 703 ms
コンパイル使用メモリ 70,504 KB
実行使用メモリ 25,592 KB
平均クエリ数 19589.39
最終ジャッジ日時 2024-06-11 10:38:07
合計ジャッジ時間 17,103 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 58
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

// clang-format off
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>
#include <queue>
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b)-1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define pii pair<int, int>
#define vi vector<int>
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T>& p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T>& vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
constexpr ll MOD = 1000000007;
int M;
constexpr int MAX = 50000;
pii pos[MAX];
pii ask(const pii& p)
{
cout << "? " << p.fst << " " << p.snd << endl;
int x,y;
cin >> x >> y;
return mp(x,y);
}
pii operator+(const pii& p1, const pii& p2)
{
return mp(p1.fst+p2.fst, p1.snd+p2.snd);
}
pii operator-(const pii& p1, const pii& p2)
{
return mp(p1.fst-p2.fst, p1.snd-p2.snd);
}
pii rotate(int flag, const pii& p)
{
if(flag == 0){
return p;
} else if (flag == 1){
return mp(-p.snd, p.fst);
} else if (flag == 2){
return mp(-p.fst, -p.snd);
} else {
return mp(p.snd, -p.fst);
}
}
int main()
{
cin >> M;
rep(i, M){
int x ,y;
cin >> x >> y;
pos[i] = mp(x,y);
}
const pii p1 = ask(mp(0,0));
const pii p2 = ask(mp(1,0));
const pii d = p2-p1;
cout << d << endl;
int flag = 0;
if(d == mp(1,0)){
flag = 0;
} else if (d == mp(0,1)) {
flag = 1;
} else if (d == mp(-1,0)){
flag = 2;
} else {
flag = 3;
}
cout << "!" << endl;
rep(i, M){
const pii ans = p1 + rotate(flag, pos[i]);
cout << ans.fst << " " << ans.snd << endl;
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0