1826F - Fading into Fog - CodeForces Solution


geometry interactive math probabilities

Please click on ads to support us..

C++ Code:

#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<=y;i++)
#define int long long
#define db long double
using namespace std;int n;
vector<array<db,2>> ask(db a,db b,db c) {
    cout<<"? "<<a<<" "<<b<<" "<<c<<endl;
    vector<array<db,2>>tmp(n);
    for(auto &[x,y]:tmp)cin>>x>>y;
    return tmp;
}void solve(){
    cout<<fixed<<setprecision(3);cin>>n;
    vector<double>X,Y,Z;
    for(auto [x,y]:ask(0,1,0))X.push_back(x);
    for(auto [x,y]:ask(1,0,0))Y.push_back(y);
    for(auto [x,y]:ask(-0.25,50.25,0))Z.push_back(x);
    cout<<"! ";double K=201;
    for(auto x:Z)rep(i,0,n-1)rep(j,0,n-1){
            double res=(K*X[i]+Y[j])*K/(K*K+1);
            if(fabs(res-x)<5e-4)
                cout<<X[i]<<" "<<Y[j]<<" ";
        }cout<<endl;
}signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int tc;cin>>tc;
    for(int i=1;i<=tc;i++)
        solve();return 0; 
}


Comments

Submit
0 Comments
More Questions

1234A - Equalize Prices Again
1613A - Long Comparison
1624B - Make AP
660B - Seating On Bus
405A - Gravity Flip
499B - Lecture
709A - Juicer
1358C - Celex Update
1466B - Last minute enhancements
450B - Jzzhu and Sequences
1582C - Grandma Capa Knits a Scarf
492A - Vanya and Cubes
217A - Ice Skating
270A - Fancy Fence
181A - Series of Crimes
1638A - Reverse
1654C - Alice and the Cake
369A - Valera and Plates
1626A - Equidistant Letters
977D - Divide by three multiply by two
1654B - Prefix Removals
1654A - Maximum Cake Tastiness
1649A - Game
139A - Petr and Book
1612A - Distance
520A - Pangram
124A - The number of positions
1041A - Heist
901A - Hashing Trees
1283A - Minutes Before the New Year