QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#797770 | #9808. Fragile Pinball | ucup-team4975# | WA | 0ms | 3652kb | C++23 | 2.3kb | 2024-12-03 17:54:30 | 2024-12-03 17:54:34 |
Judging History
answer
#define LOCAL
#include <bits/stdc++.h>
#define fir first
#define sec second
#define el '\n'
#ifdef LOCAL
#define FINISH cerr << "FINISH" << endl;
#else
#define FINISH ;
#endif
#ifdef LOCAL
#define debug(x) cerr << setw(4) << #x << " == " << x << endl
#else
#define debug(x)
#endif
#ifdef LOCAL
#define debugv(x) \
cerr << setw(4) << #x << ":: "; \
for (auto i : x) \
cerr << i << " "; \
cerr << endl
#else
#define debugv(x)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
ostream& operator<<(ostream& out, PII& x)
{
out << x.fir << " " << x.sec << endl;
return out;
}
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 200020;
struct point {
int x, y;
};
void solve()
{
int n;
cin >> n;
vector<point> p(n + 1);
for (int i = 1; i <= n; i++) {
cin >> p[i].x >> p[i].y;
}
sort(next(p.begin()), p.end(), [&](point x, point y) {
return x.x < y.x;
});
ll lasx = 0, lasy = 1;
ll areax = 0, areay = 1;
for (int i = 2; i < n; i++) {
int res = p[i].x;
if ((p[i].x + p[i - 1].x) % 2 == 0) {
cout << "? " << (p[i].x + p[i - 1].x) / 2 << " " << 1 << endl;
}
else {
cout << "? " << (p[i].x + p[i - 1].x) << " " << 2 << endl;
}
ll x, y;
cin >> x >> y;
ll nxtx = 2 * x * lasy - y * lasx;
ll nxty = y * lasy;
ll g = __gcd (nxtx, nxty);
nxtx /= g, nxty /= g;
lasx = nxtx, lasy = nxty;
ll len = p[i].x - p[i - 1].x;
x = x * len;
ll nxtareax = x * areay + y * areax;
ll nxtareay = y * areay;
g = __gcd (nxtareax, nxtareay);
areax = nxtareax / g;
areay = nxtareay / g;
}
ll len = p[n].x - p[n - 1].x;
ll nxtx = len * lasx;
ll nxty = 2 * lasy;
ll g = __gcd (nxtx, nxty);
nxtx /= g, nxty /= g;
ll nxtareax = nxty * areax + nxtx * areay;
ll nxtareay = nxty * areay;
g = __gcd (nxtareax, nxtareay);
areax = nxtareax / g;
areay = nxtareay / g;
cout << "! " << areax << " " << areay << endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T = 1;
cin >> T;
while (T--) {
solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3652kb
input:
3 4 0 0 3 0 -1
output:
? -1 2 ? 0 1 ! 443819800327358383 111970687404166090 ? 0 1 ? 0 1 ! 0 1 ? 0 1 ? 0 1 ! 0 1
result:
wrong output format Expected double, but "?" found