1
+ // https://codeforces.com/contest/215/problem/A
2
+ /*
3
+
4
+ ░██████╗██████╗░░█████╗░██████╗░░██████╗██╗░░██╗ ░██████╗░██╗░░░██╗██████╗░████████╗░█████╗░
5
+ ██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝██║░░██║ ██╔════╝░██║░░░██║██╔══██╗╚══██╔══╝██╔══██╗
6
+ ╚█████╗░██████╔╝███████║██████╔╝╚█████╗░███████║ ██║░░██╗░██║░░░██║██████╔╝░░░██║░░░███████║
7
+ ░╚═══██╗██╔═══╝░██╔══██║██╔══██╗░╚═══██╗██╔══██║ ██║░░╚██╗██║░░░██║██╔═══╝░░░░██║░░░██╔══██║
8
+ ██████╔╝██║░░░░░██║░░██║██║░░██║██████╔╝██║░░██║ ╚██████╔╝╚██████╔╝██║░░░░░░░░██║░░░██║░░██║
9
+ ╚═════╝░╚═╝░░░░░╚═╝░░╚═╝╚═╝░░╚═╝╚═════╝░╚═╝░░╚═╝ ░╚═════╝░░╚═════╝░╚═╝░░░░░░░░╚═╝░░░╚═╝░░╚═╝
10
+ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
11
+ █████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗
12
+ ╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝
13
+ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
14
+
15
+ */
16
+
17
+ #include < bits/stdc++.h>
18
+
19
+ using namespace std ;
20
+
21
+ #define fi first
22
+ #define se second
23
+ #define pb push_back
24
+ #define mp make_pair
25
+ #define all (x ) x.begin(), x.end()
26
+ #define ll long long
27
+ #define pll pair<long , long >
28
+ #define vll vector<long long >
29
+ #define inf 1e18
30
+ #define gcd (a, b ) __gcd(a, b)
31
+ #define range (a,b ) substr(a,b-a+1 )
32
+ #define fori (a, n ) for (ll i = a; i < n; i++)
33
+ #define forj (a, n ) for (ll j = a; j < n; j++)
34
+ #define fork (a, n ) for (ll k = a; k < n; k++)
35
+ #define print (x ) for (auto i : x) {cout << i << " " ;}
36
+ #define FIO ios_base::sync_with_stdio (0 ); cin.tie(0 ); cout.tie(0 )
37
+
38
+ template <class T >
39
+ bool comp (T a, T b) {
40
+ if (a < b)
41
+ return true ;
42
+ return false ;
43
+ }
44
+
45
+ int main ()
46
+ {
47
+ FIO;
48
+
49
+ #ifndef ONLINE_JUDGE
50
+ // remove this piece of code when this has to be submitted in kickstart, coding ninjas
51
+ freopen (" input.txt" , " r" , stdin);
52
+ freopen (" output.txt" , " w" , stdout);
53
+ // freopen is used to associate a file with stdin or stdout stream in C++
54
+ #endif
55
+
56
+ ll n;
57
+ cin >> n;
58
+ vll arr (n);
59
+ fori (0 , n)
60
+ cin >> arr[i];
61
+ sort (all (arr));
62
+ ll m;
63
+ cin >> m;
64
+ vll srr (m);
65
+ fori (0 , m)
66
+ cin >> srr[i];
67
+ sort (all (srr), greater<ll>());
68
+ map <ll, ll> ans;
69
+ fori (0 , n)
70
+ forj (0 , m)
71
+ if (srr[j] % arr[i] == 0 )
72
+ if (ans.find (srr[j] / arr[i]) != ans.end ())
73
+ ans[srr[j] / arr[i]]++;
74
+ else
75
+ ans.insert ({srr[j] / arr[i], 1 });
76
+ for (auto i = ans.rbegin (); i != ans.rend (); i++) {
77
+ cout << i->second << " \n " ;
78
+ break ;
79
+ }
80
+ return 0 ;
81
+ }
0 commit comments