# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1115150 | erering | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
const int MOD=819276405795233,MAXN=1e6+5,inf=1e9+5;
void A() {
srand(4382932498);
setprecision(13);
int n,t,cnt=0; cin >> n >> t;
vector<int> v(t);
for(int i=0;i<t;i++)v[i]=rand()%MOD;
while (t--) {
long double x,y; cin >> x >> y;
for(int i=1;i<=20;i++){
long double f=x/(i*v[cnt]),s=y/(i*v[cnt]);
int r=0,e=0;
for(int j=13;j>=-3;j--){
if(r==0)r=(int)(f*pow(10,j))%10;
if(e==0)e=(int)(s*pow(10,j))%10;
if(r>0 && e>0)break;
}
if(r%2==0 && e%2==1){
cout<<i<<endl;
break;
}
}
// stuff...
cnt++;
}
}
void B() {
srand(4382932498);
setprecision(13);
int n,t,cnt=0; cin >> n >> t;
vector<int> v(t);
for(int i=0;i<t;i++)v[i]=rand()%MOD;
while (t--) {
long double q,h; cin >> q >> h;
long double f=q/(h*v[cnt]);
int r=0;
for(int j=13;j>=-3;j--){
if(r==0)r=(int)(f*pow(10,j))%10;
if(r>0)break;
}
cout<<(r%2==0?"yes":"no")<<endl;
cnt++;
// stuff...
}
}
signed main()
{
/*
* 1
5 6
1 2
4 5
1 2
3 5
4 5
5 2
*/
/*
2
5 6
1 8
4 2
2 1
3 2
5 3
2 4
*
*/
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//srand(time(NULL));
int TYPE; cin >> TYPE;
TYPE == 1 ? A() : B();
}