Submission #283056

# Submission time Handle Problem Language Result Execution time Memory
283056 2020-08-25T09:22:49 Z egekabas Brunhilda’s Birthday (BOI13_brunhilda) C++14
20 / 100
1000 ms 1016 KB
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
int n, q;
int p[100009];
int ans[10000001];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    
    cin >> n >> q;
    for(int i = 0; i < n; ++i)
        cin >> p[i];
    reverse(p, p+n);
    ans[0] = 0;
    int lim = 1e4+1;
    for(int i = 1; i < lim; ++i){
        int goback = 0;
        for(int j = 0; j < n; ++j){
            goback = max(goback, i%p[j]);
        }
        if(goback == 0){
            lim = i;
            break;
        }
        ans[i] = 1+ans[i-goback];
    }
    while(q--){
        int x;
        cin >> x;
        if(x >= lim)
            cout << "oo\n";
        else
            cout << ans[x] << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 6 ms 384 KB Output is correct
13 Correct 55 ms 432 KB Output is correct
14 Correct 56 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 6 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 631 ms 632 KB Output isn't correct
2 Execution timed out 1096 ms 888 KB Time limit exceeded
3 Execution timed out 1091 ms 760 KB Time limit exceeded
4 Incorrect 165 ms 384 KB Output isn't correct
5 Execution timed out 1095 ms 632 KB Time limit exceeded
6 Incorrect 64 ms 384 KB Output isn't correct
7 Incorrect 631 ms 508 KB Output isn't correct
8 Incorrect 53 ms 384 KB Output isn't correct
9 Execution timed out 1087 ms 808 KB Time limit exceeded
10 Execution timed out 1075 ms 760 KB Time limit exceeded
11 Execution timed out 1088 ms 632 KB Time limit exceeded
12 Incorrect 112 ms 508 KB Output isn't correct
13 Incorrect 155 ms 384 KB Output isn't correct
14 Incorrect 167 ms 384 KB Output isn't correct
15 Execution timed out 1056 ms 696 KB Time limit exceeded
16 Execution timed out 1084 ms 884 KB Time limit exceeded
17 Incorrect 161 ms 384 KB Output isn't correct
18 Execution timed out 1095 ms 888 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 720 KB Time limit exceeded
2 Execution timed out 1090 ms 604 KB Time limit exceeded
3 Execution timed out 1090 ms 720 KB Time limit exceeded
4 Incorrect 191 ms 832 KB Output isn't correct
5 Execution timed out 1089 ms 888 KB Time limit exceeded
6 Incorrect 442 ms 760 KB Output isn't correct
7 Execution timed out 1096 ms 888 KB Time limit exceeded
8 Execution timed out 1090 ms 760 KB Time limit exceeded
9 Execution timed out 1096 ms 760 KB Time limit exceeded
10 Incorrect 312 ms 508 KB Output isn't correct
11 Incorrect 234 ms 504 KB Output isn't correct
12 Incorrect 314 ms 512 KB Output isn't correct
13 Execution timed out 1094 ms 512 KB Time limit exceeded
14 Incorrect 14 ms 640 KB Output isn't correct
15 Incorrect 298 ms 504 KB Output isn't correct
16 Incorrect 379 ms 504 KB Output isn't correct
17 Execution timed out 1066 ms 828 KB Time limit exceeded
18 Execution timed out 1093 ms 632 KB Time limit exceeded
19 Incorrect 275 ms 760 KB Output isn't correct
20 Execution timed out 1093 ms 724 KB Time limit exceeded
21 Incorrect 20 ms 768 KB Output isn't correct
22 Execution timed out 1088 ms 892 KB Time limit exceeded
23 Execution timed out 1089 ms 764 KB Time limit exceeded
24 Incorrect 72 ms 760 KB Output isn't correct
25 Incorrect 172 ms 632 KB Output isn't correct
26 Incorrect 191 ms 632 KB Output isn't correct
27 Execution timed out 1055 ms 768 KB Time limit exceeded
28 Incorrect 67 ms 760 KB Output isn't correct
29 Execution timed out 1037 ms 1016 KB Time limit exceeded
30 Execution timed out 1084 ms 792 KB Time limit exceeded
31 Incorrect 242 ms 888 KB Output isn't correct
32 Incorrect 166 ms 632 KB Output isn't correct
33 Incorrect 77 ms 632 KB Output isn't correct
34 Execution timed out 1090 ms 888 KB Time limit exceeded
35 Incorrect 118 ms 760 KB Output isn't correct
36 Execution timed out 1058 ms 760 KB Time limit exceeded
37 Execution timed out 1091 ms 888 KB Time limit exceeded
38 Incorrect 441 ms 760 KB Output isn't correct
39 Incorrect 135 ms 632 KB Output isn't correct
40 Incorrect 511 ms 760 KB Output isn't correct
41 Execution timed out 1059 ms 888 KB Time limit exceeded
42 Incorrect 174 ms 760 KB Output isn't correct