Submission #155723

#TimeUsernameProblemLanguageResultExecution timeMemory
155723HungAnhGoldIBO2020Brunhilda’s Birthday (BOI13_brunhilda)C++14
8.10 / 100
38 ms2936 KiB
#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)

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:10:14: warning: unused variable 'k' [-Wunused-variable]
  int n,m,i,j,k,l,lcm=1,max1=0;
              ^
brunhilda.cpp:10:16: warning: unused variable 'l' [-Wunused-variable]
  int n,m,i,j,k,l,lcm=1,max1=0;
                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...