Submission #155723

# Submission time Handle Problem Language Result Execution time Memory
155723 2019-09-30T06:48:22 Z HungAnhGoldIBO2020 Brunhilda’s Birthday (BOI13_brunhilda) C++14
8.09524 / 100
38 ms 2936 KB
#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

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 time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 0 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 4 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Incorrect 2 ms 380 KB Output isn't correct
12 Correct 2 ms 376 KB Output is correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Incorrect 4 ms 376 KB Output isn't correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Incorrect 2 ms 376 KB Output isn't correct
17 Incorrect 4 ms 376 KB Output isn't correct
18 Incorrect 4 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 376 KB Output isn't correct
2 Correct 14 ms 1016 KB Output is correct
3 Correct 10 ms 888 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Correct 9 ms 760 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 3 ms 376 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 11 ms 888 KB Output isn't correct
10 Correct 10 ms 888 KB Output is correct
11 Incorrect 7 ms 660 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Incorrect 3 ms 376 KB Output isn't correct
14 Incorrect 2 ms 376 KB Output isn't correct
15 Incorrect 7 ms 632 KB Output isn't correct
16 Correct 13 ms 1016 KB Output is correct
17 Incorrect 2 ms 376 KB Output isn't correct
18 Incorrect 14 ms 1144 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1016 KB Output isn't correct
2 Incorrect 14 ms 888 KB Output isn't correct
3 Incorrect 20 ms 1112 KB Output isn't correct
4 Incorrect 21 ms 1272 KB Output isn't correct
5 Incorrect 35 ms 1912 KB Output isn't correct
6 Incorrect 24 ms 1260 KB Output isn't correct
7 Incorrect 25 ms 1528 KB Output isn't correct
8 Incorrect 16 ms 1016 KB Output isn't correct
9 Incorrect 16 ms 1016 KB Output isn't correct
10 Incorrect 5 ms 376 KB Output isn't correct
11 Incorrect 7 ms 504 KB Output isn't correct
12 Incorrect 7 ms 504 KB Output isn't correct
13 Incorrect 24 ms 1320 KB Output isn't correct
14 Incorrect 23 ms 1700 KB Output isn't correct
15 Incorrect 8 ms 632 KB Output isn't correct
16 Incorrect 7 ms 508 KB Output isn't correct
17 Incorrect 9 ms 760 KB Output isn't correct
18 Incorrect 13 ms 888 KB Output isn't correct
19 Incorrect 7 ms 504 KB Output isn't correct
20 Incorrect 19 ms 1144 KB Output isn't correct
21 Incorrect 24 ms 1656 KB Output isn't correct
22 Incorrect 35 ms 2040 KB Output isn't correct
23 Incorrect 26 ms 1436 KB Output isn't correct
24 Incorrect 23 ms 1400 KB Output isn't correct
25 Incorrect 22 ms 1528 KB Output isn't correct
26 Incorrect 21 ms 1400 KB Output isn't correct
27 Incorrect 25 ms 2296 KB Output isn't correct
28 Incorrect 23 ms 1528 KB Output isn't correct
29 Incorrect 34 ms 2936 KB Output isn't correct
30 Incorrect 31 ms 2392 KB Output isn't correct
31 Incorrect 20 ms 1400 KB Output isn't correct
32 Incorrect 22 ms 1400 KB Output isn't correct
33 Incorrect 21 ms 1288 KB Output isn't correct
34 Incorrect 25 ms 2424 KB Output isn't correct
35 Incorrect 38 ms 1528 KB Output isn't correct
36 Incorrect 34 ms 2748 KB Output isn't correct
37 Incorrect 35 ms 2808 KB Output isn't correct
38 Incorrect 23 ms 1528 KB Output isn't correct
39 Incorrect 24 ms 1400 KB Output isn't correct
40 Incorrect 22 ms 1400 KB Output isn't correct
41 Correct 26 ms 2424 KB Output is correct
42 Incorrect 23 ms 1528 KB Output isn't correct