답안 #159755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
159755 2019-10-24T13:04:58 Z Rouge_Hugo Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
1000 ms 888 KB
#include <bits/stdc++.h>

using namespace std;
int n,q;
long long dp[10009];
int a[10009];
long long  d(int x)
{
    if (x==0)return 0;
    if (dp[x]!=-1)return dp[x];
    long long mn=1000000000;
    for(int i=0;i<n;i++)
    {
        if (x%a[i]!=0)mn=min(mn,1+d(x-(x%a[i])));
    }
    return mn;
}
int main()
{
    cin>>n>>q;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    int x;
    memset (dp,-1,sizeof dp);
    while (q--)
    {
        cin>>x;
        long long u=d(x);
        if (u>=1000000)cout<<"oo"<<endl;
        else cout<<u<<endl;

    }

}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1077 ms 376 KB Time limit exceeded
2 Execution timed out 1080 ms 376 KB Time limit exceeded
3 Execution timed out 1067 ms 376 KB Time limit exceeded
4 Execution timed out 1080 ms 376 KB Time limit exceeded
5 Execution timed out 1084 ms 376 KB Time limit exceeded
6 Execution timed out 1079 ms 376 KB Time limit exceeded
7 Execution timed out 1078 ms 376 KB Time limit exceeded
8 Execution timed out 1073 ms 376 KB Time limit exceeded
9 Execution timed out 1082 ms 376 KB Time limit exceeded
10 Execution timed out 1074 ms 504 KB Time limit exceeded
11 Execution timed out 1082 ms 504 KB Time limit exceeded
12 Execution timed out 1081 ms 376 KB Time limit exceeded
13 Execution timed out 1084 ms 632 KB Time limit exceeded
14 Execution timed out 1080 ms 376 KB Time limit exceeded
15 Execution timed out 1088 ms 504 KB Time limit exceeded
16 Execution timed out 1074 ms 376 KB Time limit exceeded
17 Execution timed out 1075 ms 376 KB Time limit exceeded
18 Execution timed out 1084 ms 376 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 21 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 19 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 19 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 9 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 19 ms 724 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 19 ms 732 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 19 ms 692 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 20 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 20 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 19 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 19 ms 732 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 19 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 19 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 19 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 7 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 20 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 19 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 19 ms 676 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 5 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 19 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 6 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 19 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 20 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 19 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 2 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 19 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 19 ms 688 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 19 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 19 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 19 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 4 ms 628 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 3 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 19 ms 708 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 19 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 20 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 7 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 7 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Runtime error 19 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 4 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)