#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define maxn 110000
#define mxv 10000000
int m, q, p[maxn];
void solve() {
cin >> m >> q;
for(int i = 1; i <= m; i++) {
cin >> p[i];
}
int x; cin >> x;
int ans = 0;
while(x != 0) {
int mn = x;
for(int i = 1; i <= m; i++) {
mn = min(mn, x - x%p[i]);
}
if(mn == x) {
cout << "oo" << endl;
return;
}
x = mn;
ans++;
}
cout << ans << endl;
}
int32_t main() {
ios::sync_with_stdio(false); cin.tie(0);
// freopen("in.in", "r", stdin);
//freopen("out.out", "w", stdout);
int tt = 1;
// cin >> tt;
while(tt--) solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
332 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
320 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
332 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
332 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
320 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
320 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
328 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
17 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
18 |
Incorrect |
0 ms |
332 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
440 KB |
Output is correct |
2 |
Correct |
10 ms |
1636 KB |
Output is correct |
3 |
Correct |
7 ms |
1320 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
5 |
Correct |
5 ms |
948 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
2 ms |
440 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
7 ms |
1348 KB |
Output is correct |
10 |
Correct |
6 ms |
1228 KB |
Output is correct |
11 |
Correct |
8 ms |
824 KB |
Output is correct |
12 |
Correct |
3 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
3 ms |
332 KB |
Output is correct |
15 |
Correct |
5 ms |
840 KB |
Output is correct |
16 |
Correct |
8 ms |
1696 KB |
Output is correct |
17 |
Correct |
7 ms |
332 KB |
Output is correct |
18 |
Correct |
10 ms |
1732 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
1188 KB |
Output isn't correct |
2 |
Incorrect |
5 ms |
1180 KB |
Output isn't correct |
3 |
Incorrect |
9 ms |
1128 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
5 |
Incorrect |
12 ms |
1988 KB |
Output isn't correct |
6 |
Incorrect |
5 ms |
568 KB |
Output isn't correct |
7 |
Incorrect |
10 ms |
1864 KB |
Output isn't correct |
8 |
Incorrect |
7 ms |
1092 KB |
Output isn't correct |
9 |
Incorrect |
7 ms |
1080 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
464 KB |
Output isn't correct |
11 |
Incorrect |
3 ms |
460 KB |
Output isn't correct |
12 |
Incorrect |
4 ms |
460 KB |
Output isn't correct |
13 |
Incorrect |
5 ms |
844 KB |
Output isn't correct |
14 |
Incorrect |
12 ms |
364 KB |
Output isn't correct |
15 |
Incorrect |
4 ms |
460 KB |
Output isn't correct |
16 |
Incorrect |
4 ms |
460 KB |
Output isn't correct |
17 |
Incorrect |
5 ms |
1076 KB |
Output isn't correct |
18 |
Incorrect |
4 ms |
1104 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
456 KB |
Output isn't correct |
20 |
Incorrect |
7 ms |
1088 KB |
Output isn't correct |
21 |
Incorrect |
9 ms |
332 KB |
Output isn't correct |
22 |
Incorrect |
10 ms |
1848 KB |
Output isn't correct |
23 |
Incorrect |
4 ms |
844 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
25 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
26 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
27 |
Incorrect |
11 ms |
1840 KB |
Output isn't correct |
28 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
29 |
Incorrect |
11 ms |
1952 KB |
Output isn't correct |
30 |
Incorrect |
9 ms |
1456 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
33 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
34 |
Incorrect |
11 ms |
1960 KB |
Output isn't correct |
35 |
Incorrect |
2 ms |
324 KB |
Output isn't correct |
36 |
Incorrect |
8 ms |
1856 KB |
Output isn't correct |
37 |
Incorrect |
10 ms |
1968 KB |
Output isn't correct |
38 |
Incorrect |
5 ms |
576 KB |
Output isn't correct |
39 |
Incorrect |
2 ms |
328 KB |
Output isn't correct |
40 |
Incorrect |
3 ms |
572 KB |
Output isn't correct |
41 |
Incorrect |
12 ms |
2088 KB |
Output isn't correct |
42 |
Incorrect |
6 ms |
460 KB |
Output isn't correct |