Submission #283213

# Submission time Handle Problem Language Result Execution time Memory
283213 2020-08-25T11:25:58 Z Atill83 Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
1000 ms 7732 KB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll m, q;
ll p[MAXN];
int ans[MAXN];



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/int.txt","r",stdin);
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/out.txt","w",stdout);
    #endif

    cin>>m>>q;
    memset(ans, 0x7f, sizeof(ans));
    for(int i = 0; i < m; i++){
        cin>>p[i];
    }

    for(int i = 1; i < p[m - 1]; i++){
        ans[i] = 1;
    }

    for(int i = p[m - 1]; i <= 1e7; i++){
        for(int j = m - 1; j >= 0; j--){
            if(i % p[j] == 0) continue;
            ans[i] = min(ans[i - i % p[j]] + 1, ans[i]);
            break;
        }
    }

    for(int i = 0; i < q; i++){
        int n;
        cin>>n;
        if(ans[n] > 1e7){
            cout<<"oo"<<endl;
        }else{
            cout<<ans[n]<<endl;
        }
    }

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 7552 KB Execution killed with signal 11
2 Runtime error 14 ms 7552 KB Execution killed with signal 11
3 Runtime error 15 ms 7552 KB Execution killed with signal 11
4 Runtime error 18 ms 7732 KB Execution killed with signal 11
5 Runtime error 16 ms 7552 KB Execution killed with signal 11
6 Runtime error 16 ms 7552 KB Execution killed with signal 11
7 Runtime error 15 ms 7552 KB Execution killed with signal 11
8 Runtime error 18 ms 7616 KB Execution killed with signal 11
9 Runtime error 16 ms 7552 KB Execution killed with signal 11
10 Runtime error 17 ms 7680 KB Execution killed with signal 11
11 Runtime error 15 ms 7552 KB Execution killed with signal 11
12 Runtime error 19 ms 7680 KB Execution killed with signal 11
13 Runtime error 81 ms 7676 KB Execution killed with signal 11
14 Runtime error 86 ms 7672 KB Execution killed with signal 11
15 Runtime error 14 ms 7552 KB Execution killed with signal 11
16 Runtime error 15 ms 7552 KB Execution killed with signal 11
17 Runtime error 16 ms 7552 KB Execution killed with signal 11
18 Runtime error 18 ms 7552 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 7680 KB Execution killed with signal 11
2 Runtime error 19 ms 7552 KB Execution killed with signal 11
3 Runtime error 15 ms 7552 KB Execution killed with signal 11
4 Execution timed out 1092 ms 2756 KB Time limit exceeded
5 Runtime error 12 ms 7552 KB Execution killed with signal 11
6 Runtime error 874 ms 7544 KB Execution killed with signal 11
7 Runtime error 9 ms 7552 KB Execution killed with signal 11
8 Runtime error 240 ms 7544 KB Execution killed with signal 11
9 Runtime error 14 ms 7680 KB Execution killed with signal 11
10 Runtime error 14 ms 7672 KB Execution killed with signal 11
11 Runtime error 12 ms 7548 KB Execution killed with signal 11
12 Runtime error 812 ms 7672 KB Execution killed with signal 11
13 Runtime error 11 ms 7552 KB Execution killed with signal 11
14 Execution timed out 1090 ms 3064 KB Time limit exceeded
15 Runtime error 12 ms 7552 KB Execution killed with signal 11
16 Runtime error 17 ms 7552 KB Execution killed with signal 11
17 Execution timed out 1090 ms 3204 KB Time limit exceeded
18 Runtime error 17 ms 7552 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 7552 KB Execution killed with signal 11
2 Runtime error 15 ms 7552 KB Execution killed with signal 11
3 Runtime error 14 ms 7552 KB Execution killed with signal 11
4 Execution timed out 1090 ms 2808 KB Time limit exceeded
5 Runtime error 18 ms 7544 KB Execution killed with signal 11
6 Execution timed out 1092 ms 2168 KB Time limit exceeded
7 Runtime error 17 ms 7544 KB Execution killed with signal 11
8 Runtime error 15 ms 7552 KB Execution killed with signal 11
9 Runtime error 13 ms 7552 KB Execution killed with signal 11
10 Execution timed out 1089 ms 2296 KB Time limit exceeded
11 Execution timed out 1031 ms 2460 KB Time limit exceeded
12 Execution timed out 1087 ms 2460 KB Time limit exceeded
13 Runtime error 11 ms 7552 KB Execution killed with signal 11
14 Runtime error 14 ms 7552 KB Execution killed with signal 11
15 Execution timed out 1097 ms 2296 KB Time limit exceeded
16 Execution timed out 1086 ms 2208 KB Time limit exceeded
17 Runtime error 13 ms 7552 KB Execution killed with signal 11
18 Runtime error 14 ms 7552 KB Execution killed with signal 11
19 Runtime error 9 ms 7552 KB Execution killed with signal 11
20 Runtime error 12 ms 7552 KB Execution killed with signal 11
21 Runtime error 14 ms 7552 KB Execution killed with signal 11
22 Runtime error 17 ms 7552 KB Execution killed with signal 11
23 Runtime error 10 ms 7552 KB Execution killed with signal 11
24 Runtime error 816 ms 7732 KB Execution killed with signal 11
25 Execution timed out 1091 ms 3832 KB Time limit exceeded
26 Execution timed out 1087 ms 2764 KB Time limit exceeded
27 Runtime error 18 ms 7552 KB Execution killed with signal 11
28 Execution timed out 1085 ms 3140 KB Time limit exceeded
29 Runtime error 17 ms 7552 KB Execution killed with signal 11
30 Runtime error 14 ms 7656 KB Execution killed with signal 11
31 Execution timed out 1086 ms 1892 KB Time limit exceeded
32 Execution timed out 1094 ms 2808 KB Time limit exceeded
33 Execution timed out 1093 ms 2936 KB Time limit exceeded
34 Runtime error 17 ms 7552 KB Execution killed with signal 11
35 Execution timed out 1093 ms 2424 KB Time limit exceeded
36 Runtime error 17 ms 7552 KB Execution killed with signal 11
37 Runtime error 17 ms 7552 KB Execution killed with signal 11
38 Execution timed out 1088 ms 2040 KB Time limit exceeded
39 Execution timed out 1087 ms 2680 KB Time limit exceeded
40 Execution timed out 1092 ms 1784 KB Time limit exceeded
41 Runtime error 17 ms 7552 KB Execution killed with signal 11
42 Execution timed out 1085 ms 3576 KB Time limit exceeded