# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
155723 | HungAnhGoldIBO2020 | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 38 ms | 2936 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<iostream>
#include<algorithm>
#define int long long
const int N=1e5+2;
using namespace std;
int ar[N];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,m,i,j,k,l,lcm=1,max1=0;
cin>>n>>m;
for(i=1;i<=n;i++){
cin>>ar[i];
max1=max(max1,ar[i]);
if(lcm<=1e7){
lcm=(lcm*(ar[i]/__gcd(ar[i],lcm)));
}
}
for(i=1;i<=m;i++){
cin>>j;
if(j>=lcm){
cout<<"oo\n";
continue;
}
if(j%max1==0){
cout<<2*(j/max1)<<'\n';
}
else{
cout<<2*(j/max1)+1<<'\n';
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |