답안 #742479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
742479 2023-05-16T09:57:35 Z irmuun Brunhilda’s Birthday (BOI13_brunhilda) C++17
20 / 100
13 ms 2264 KB
#include<bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define all(s) s.begin(),s.end()

const int MAX=1e9;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int m,q;
    cin>>m>>q;
    int p[m+5];
    for(int i=1;i<=m;i++){
        cin>>p[i];
    }
    sort(p+1,p+m+1);
    int ans[10005];
    ans[0]=0;
    for(int i=1;i<p[m];i++){
        ans[i]=1;
    }
    for(int i=p[m];i<=10000;i++){
        ans[i]=MAX;
        for(int j=1;j<=m;j++){
            ans[i]=min(ans[i],ans[i/p[j]*p[j]]+1);
        }
    }
    while(q--){
        int n;
        cin>>n;
        if(ans[n]==MAX){
            cout<<"oo\n";
        }
        else{
            cout<<ans[n]<<"\n";
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 3 ms 352 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 352 KB Output is correct
9 Correct 2 ms 352 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 4 ms 352 KB Output is correct
13 Correct 6 ms 364 KB Output is correct
14 Correct 8 ms 404 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 3 ms 340 KB Output is correct
17 Correct 5 ms 340 KB Output is correct
18 Correct 5 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 624 KB Execution killed with signal 11
2 Runtime error 10 ms 1856 KB Execution killed with signal 11
3 Runtime error 8 ms 1512 KB Execution killed with signal 11
4 Runtime error 1 ms 516 KB Execution killed with signal 11
5 Runtime error 6 ms 1300 KB Execution killed with signal 11
6 Runtime error 1 ms 468 KB Execution killed with signal 11
7 Runtime error 2 ms 596 KB Execution killed with signal 11
8 Runtime error 1 ms 468 KB Execution killed with signal 11
9 Runtime error 8 ms 1512 KB Execution killed with signal 11
10 Runtime error 8 ms 1488 KB Execution killed with signal 11
11 Runtime error 6 ms 1108 KB Execution killed with signal 11
12 Runtime error 1 ms 468 KB Execution killed with signal 11
13 Runtime error 1 ms 496 KB Execution killed with signal 11
14 Runtime error 1 ms 468 KB Execution killed with signal 11
15 Runtime error 5 ms 1052 KB Execution killed with signal 11
16 Runtime error 10 ms 1876 KB Execution killed with signal 11
17 Runtime error 1 ms 468 KB Execution killed with signal 11
18 Runtime error 12 ms 2016 KB Execution killed with signal 11
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 1388 KB Execution killed with signal 11
2 Runtime error 6 ms 1392 KB Execution killed with signal 11
3 Runtime error 7 ms 1364 KB Execution killed with signal 11
4 Runtime error 1 ms 596 KB Execution killed with signal 11
5 Runtime error 11 ms 2264 KB Execution killed with signal 11
6 Runtime error 2 ms 756 KB Execution killed with signal 11
7 Runtime error 11 ms 2160 KB Execution killed with signal 11
8 Runtime error 8 ms 1428 KB Execution killed with signal 11
9 Runtime error 6 ms 1420 KB Execution killed with signal 11
10 Runtime error 2 ms 596 KB Execution killed with signal 11
11 Runtime error 1 ms 596 KB Execution killed with signal 11
12 Runtime error 1 ms 596 KB Execution killed with signal 11
13 Runtime error 4 ms 1132 KB Execution killed with signal 11
14 Runtime error 2 ms 492 KB Execution killed with signal 11
15 Runtime error 1 ms 620 KB Execution killed with signal 11
16 Runtime error 2 ms 844 KB Execution killed with signal 11
17 Runtime error 5 ms 1236 KB Execution killed with signal 11
18 Runtime error 6 ms 1364 KB Execution killed with signal 11
19 Runtime error 1 ms 596 KB Execution killed with signal 11
20 Runtime error 5 ms 1440 KB Execution killed with signal 11
21 Runtime error 6 ms 532 KB Execution killed with signal 11
22 Runtime error 11 ms 2140 KB Execution killed with signal 11
23 Runtime error 4 ms 1136 KB Execution killed with signal 11
24 Runtime error 1 ms 596 KB Execution killed with signal 11
25 Runtime error 2 ms 596 KB Execution killed with signal 11
26 Runtime error 1 ms 596 KB Execution killed with signal 11
27 Runtime error 11 ms 2144 KB Execution killed with signal 11
28 Runtime error 1 ms 492 KB Execution killed with signal 11
29 Runtime error 11 ms 2136 KB Execution killed with signal 11
30 Runtime error 11 ms 1632 KB Execution killed with signal 11
31 Runtime error 2 ms 596 KB Execution killed with signal 11
32 Runtime error 1 ms 596 KB Execution killed with signal 11
33 Runtime error 1 ms 468 KB Execution killed with signal 11
34 Runtime error 11 ms 2132 KB Execution killed with signal 11
35 Runtime error 1 ms 596 KB Execution killed with signal 11
36 Runtime error 9 ms 2132 KB Execution killed with signal 11
37 Runtime error 11 ms 2260 KB Execution killed with signal 11
38 Runtime error 2 ms 752 KB Execution killed with signal 11
39 Runtime error 1 ms 620 KB Execution killed with signal 11
40 Runtime error 2 ms 724 KB Execution killed with signal 11
41 Runtime error 13 ms 2260 KB Execution killed with signal 11
42 Runtime error 2 ms 596 KB Execution killed with signal 11