QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#818164#9804. Guess the Polygonljljljlj#WA 1ms3492kbC++201.4kb2024-12-17 17:04:592024-12-17 17:05:00

Judging History

This is the latest submission verdict.

  • [2024-12-17 17:05:00]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3492kb
  • [2024-12-17 17:04:59]
  • Submitted

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)