QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#800935 | #9804. Guess the Polygon | ucup-team135# | WA | 1ms | 3636kb | C++20 | 1.5kb | 2024-12-06 16:58:24 | 2024-12-06 16:58:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int p=998244353;
int po(int a,int b) {if(b==0) return 1; if(b==1) return a; if(b%2==0) {int u=po(a,b/2);return (u*1LL*u)%p;} else {int u=po(a,b-1);return (a*1LL*u)%p;}}
int inv(int x) {return po(x,p-2);}
mt19937 rnd;
#define app push_back
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define debug(...) [](auto...a){ ((cout << a << ' '), ...) << endl;}(#__VA_ARGS__, ":", __VA_ARGS__)
#define debugv(v) do {cout<< #v <<" : {"; for(int izxc=0;izxc<v.size();++izxc) {cout << v[izxc];if(izxc+1!=v.size()) cout << ","; }cout <<"}"<< endl;} while(0)
#else
#define debug(...)
#define debugv(v)
#endif
#define lob(a,x) lower_bound(all(a),x)
#define upb(a,x) upper_bound(all(a),x)
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;cin>>t;
while(t--)
{
int n;cin>>n;
vector<int> xs;
vector<pair<int,int> > a(n);for(int i=0;i<n;++i) {cin>>a[i].first>>a[i].second;xs.app(a[i].first);}
sort(all(xs));xs.erase(unique(all(xs)),xs.end());
int u=0,v=1;
for(int i=1;i+1<xs.size();++i)
{
cout<<"? "<<xs[i]<<' '<<1<<endl;
int p,q;cin>>p>>q;
p*=(xs[i+1]-xs[i-1]);
int u1=u*q+v*p;int u2=q*v;
int o=__gcd(u1,u2);
u1/=o;u2/=o;
u=u1;v=u2;
}
v*=2;
int o=__gcd(u,v);u/=o;v/=o;
cout<<"! "<<u<<' '<<v<<endl;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3636kb
input:
2 4 3 0 1 3 1 1 0 0 2 1 3 0 0 999 1000 1000 999 1999 1000
output:
? 1 1 ! 3 1 ? 999 1 ! 1999 2
result:
ok correct! (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3580kb
input:
9 4 1 1 1 3 3 0 0 0 3 1
output:
? 1 1 ! 9 2
result:
wrong answer the answer is incorrect, expect: 5/2, find: 9/2 (test case 1)