QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#818156 | #9804. Guess the Polygon | ljljljlj# | WA | 0ms | 3816kb | C++20 | 2.4kb | 2024-12-17 17:00:01 | 2024-12-17 17:00:01 |
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);
vector<int> p(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());
for (int i = 0; i < n; i++)
if (flag == 1) {
for (int i = 1; i < n; 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]);
}
}
// pii len, len1;
// int ans = 0;
// int flag1 = points[1].first, flag2 = points[n].first;
// if (mp[points[1].first] > 1) {
// if (mp[points[1].first] > 2) {
// } else {
// quary(points[1].first, 1);
// len = re();
// }
// } else {
// }
// for (int i = 2; i < n; i++) {
// if (points[i].first == flag1 || points[i].first == flag2)
// continue;
// quary(points[i].first, 1);
// pii temp = re();
// if (temp.second == 1)
// temp.first *= 2;
// ans = ans + (len.first + temp.first) * (points[i].first - points[i - 1].first);
// len = temp;
// }
// if (mp[points[n].first] > 1) {
// quary(points[n].first, 1);
// len1 = re();
// } else {
// }
cout << "! " << ans / __gcd(ans, (int)2) << ' ' << 2 / __gcd(ans, (int)2) << 'endl';
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while (t--) {
solve();
}
// system("pause");
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3816kb
input:
2 4 3 0 1 3 1 1 0 0 1 1 1 1
output:
? 1 2 ? 2 1 ? 2 1
result:
wrong answer number of queries exceeds the limit: 2 (test case 1)