QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#818164 | #9804. Guess the Polygon | ljljljlj# | WA | 1ms | 3492kb | C++20 | 1.4kb | 2024-12-17 17:04:59 | 2024-12-17 17:05:00 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> pii;
map<int, int> mp;
void quary(int x, int y = 1) {
cout << "? " << x / __gcd(x, y) << ' ' << y / __gcd(x, y) << endl;
}
pair<int, int> re() {
int x, y;
cin >> x >> y;
return {x, y};
}
void solve() {
int n;
cin >> n;
int flag = 0;
int ans = 0;
vector<int> points(n + 1);
for (int i = 0; i < n; i++) {
int y;
cin >> points[i] >> y;
mp[points[i]]++;
if (mp[points[i]] > 1)
flag = 1;
}
sort(points.begin(), points.end());
// erase(unique(points.begin(),points.end())
points.erase(unique(points.begin(), points.end()), points.end());
if (flag == 1) {
for (int i = 1; i < points.size(); i++) {
quary(points[i - 1] + points[i], 2);
pii x = re();
ans += x.first * 2 / x.second * (points[i] - points[i - 1]);
}
} else {
for (int i = 1; i < n - 1; i++) {
quary(points[i]);
pii x = re();
ans += x.first * 2 / x.second * (points[i] - points[i - 1]);
}
}
cout << "! " << ans / __gcd(ans, (int)2) << ' ' << 2 / __gcd(ans, (int)2) << endl;
}
signed main() {
int t = 1;
cin >> t;
while (t--) {
solve();
}
// system("pause");
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3492kb
input:
2 4 3 0 1 3 1 1 0 0 1 1 1 1 3 0 0 999 1000 1000 999 1999 2000
output:
? 1 2 ? 2 1 ! 3 1 ? 999 2 ? 1999 2
result:
wrong answer number of queries exceeds the limit: 1 (test case 2)