답안 #283055

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283055 2020-08-25T09:21:23 Z egekabas Brunhilda’s Birthday (BOI13_brunhilda) C++14
20 / 100
1000 ms 1020 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){
        ans[i] = 1e9;
        for(int j = 0; j < n; ++j){
            if(i%p[j] != 0){
                ans[i] = min(ans[i], 1+ans[i-i%p[j]]);
            }
        }
        if(ans[i] == 1e9){
            lim = i;
            break;
        }
    }
    while(q--){
        int x;
        cin >> x;
        if(x >= lim)
            cout << "oo\n";
        else
            cout << ans[x] << '\n';
    }
}
# 결과 실행 시간 메모리 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 8 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 384 KB Output is correct
14 Correct 57 ms 428 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 8 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 650 ms 632 KB Output isn't correct
2 Execution timed out 1089 ms 760 KB Time limit exceeded
3 Execution timed out 1054 ms 760 KB Time limit exceeded
4 Incorrect 168 ms 384 KB Output isn't correct
5 Execution timed out 1063 ms 632 KB Time limit exceeded
6 Incorrect 64 ms 384 KB Output isn't correct
7 Incorrect 633 ms 504 KB Output isn't correct
8 Incorrect 53 ms 384 KB Output isn't correct
9 Execution timed out 1041 ms 760 KB Time limit exceeded
10 Execution timed out 1079 ms 760 KB Time limit exceeded
11 Execution timed out 1098 ms 636 KB Time limit exceeded
12 Incorrect 114 ms 384 KB Output isn't correct
13 Incorrect 158 ms 384 KB Output isn't correct
14 Incorrect 167 ms 384 KB Output isn't correct
15 Execution timed out 1099 ms 512 KB Time limit exceeded
16 Execution timed out 1096 ms 760 KB Time limit exceeded
17 Incorrect 160 ms 384 KB Output isn't correct
18 Execution timed out 1095 ms 888 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1091 ms 764 KB Time limit exceeded
2 Execution timed out 1095 ms 632 KB Time limit exceeded
3 Execution timed out 1076 ms 632 KB Time limit exceeded
4 Incorrect 193 ms 760 KB Output isn't correct
5 Execution timed out 1095 ms 888 KB Time limit exceeded
6 Incorrect 463 ms 760 KB Output isn't correct
7 Execution timed out 1098 ms 768 KB Time limit exceeded
8 Execution timed out 1064 ms 760 KB Time limit exceeded
9 Execution timed out 1099 ms 512 KB Time limit exceeded
10 Incorrect 318 ms 504 KB Output isn't correct
11 Incorrect 236 ms 632 KB Output isn't correct
12 Incorrect 330 ms 504 KB Output isn't correct
13 Execution timed out 1093 ms 888 KB Time limit exceeded
14 Incorrect 15 ms 640 KB Output isn't correct
15 Incorrect 298 ms 516 KB Output isn't correct
16 Incorrect 380 ms 504 KB Output isn't correct
17 Execution timed out 1091 ms 760 KB Time limit exceeded
18 Execution timed out 1050 ms 888 KB Time limit exceeded
19 Incorrect 273 ms 432 KB Output isn't correct
20 Execution timed out 1097 ms 512 KB Time limit exceeded
21 Incorrect 20 ms 640 KB Output isn't correct
22 Execution timed out 1055 ms 896 KB Time limit exceeded
23 Execution timed out 1077 ms 764 KB Time limit exceeded
24 Incorrect 73 ms 632 KB Output isn't correct
25 Incorrect 167 ms 780 KB Output isn't correct
26 Incorrect 195 ms 632 KB Output isn't correct
27 Execution timed out 1089 ms 888 KB Time limit exceeded
28 Incorrect 67 ms 636 KB Output isn't correct
29 Execution timed out 1094 ms 888 KB Time limit exceeded
30 Execution timed out 1094 ms 888 KB Time limit exceeded
31 Incorrect 250 ms 888 KB Output isn't correct
32 Incorrect 167 ms 888 KB Output isn't correct
33 Incorrect 78 ms 632 KB Output isn't correct
34 Execution timed out 1088 ms 1016 KB Time limit exceeded
35 Incorrect 119 ms 668 KB Output isn't correct
36 Execution timed out 1086 ms 1000 KB Time limit exceeded
37 Execution timed out 1093 ms 784 KB Time limit exceeded
38 Incorrect 443 ms 1020 KB Output isn't correct
39 Incorrect 135 ms 828 KB Output isn't correct
40 Incorrect 513 ms 760 KB Output isn't correct
41 Execution timed out 1040 ms 976 KB Time limit exceeded
42 Incorrect 174 ms 760 KB Output isn't correct