結果
問題 | No.471 直列回転機 |
ユーザー |
![]() |
提出日時 | 2020-02-04 03:06:56 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 304 ms / 3,141 ms |
コード長 | 1,581 bytes |
コンパイル時間 | 1,874 ms |
コンパイル使用メモリ | 158,288 KB |
実行使用メモリ | 25,592 KB |
平均クエリ数 | 19589.39 |
最終ジャッジ日時 | 2024-06-11 10:45:06 |
合計ジャッジ時間 | 12,951 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 58 |
ソースコード
#include "bits/stdc++.h"using namespace std;#define int long long#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 RREP(i, n) for(int i=(n-1); i>=0; i--)#define ALL(a) (a).begin(),(a).end()#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()#define array2(type, x, y) array<array<type, y>, x>#define vector2(type) vector<vector<type> >#define out(...) printf(__VA_ARGS__)int dxy[] = {0, 1, 0, -1, 0};void solve();signed main(){//#if DEBUG// std::ifstream in("input.txt");// std::cin.rdbuf(in.rdbuf());//#endifcin.tie(0);ios::sync_with_stdio(false);solve();return 0;}/*================================*/#if DEBUG#define SIZE 100#else#define SIZE 123450#endifint N,M,Q;int P[123450][2];void query(int x, int y, int *x0, int *y0) {out("? %lld %lld\n", x, y);fflush(stdout);cin >> *x0 >> *y0;}void solve() {cin>>M;REP(i,M) {cin>>P[i][0]>>P[i][1];}int x0,y0,x1,y1,x2,y2;query(0, 0, &x0, &y0);query(1, 0, &x1, &y1);query(0, 1, &x2, &y2);/*|xn| |a b c||x||yn|=|d e f||y|| 1| |0 0 1||1|*/int a,b,c,d,e,f;c = x0;a = x1 - x0;b = x2 - x0;f = y0;d = y1 - y0;e = y2 - y0;cout << "!" << endl;REP(i,M) {int x = a*P[i][0] + b*P[i][1]+c;int y = d*P[i][0] + e*P[i][1]+f;out("%lld %lld\n",x,y);}}