Submission #283207

# Submission time Handle Problem Language Result Execution time Memory
283207 2020-08-25T11:17:01 Z Atill83 Brunhilda’s Birthday (BOI13_brunhilda) C++14
5.87302 / 100
43 ms 1400 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];

bool check(int n){

    for(int i = 0; i < (1<<m); i++){
        int cur = n;
        for(int j = m - 1; j >= 0; j--){
            if((1<<j)&i){
                cur = cur - cur % p[j];
            }
        }
        if(cur < p[m - 1]) return 1;
    }
    return 0;
}



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;

    for(int i = 0; i < m; i++){
        cin>>p[i];
    }

    for(int i = 0; i < q; i++){
        int n;
        cin>>n;
        if(p[m - 1] > n){
            cout<<1<<endl;
        }else{
            if(m <= 9 && check(n) == 0){
                cout<<"oo\n";
            }else{
                cout<<(n / p[m - 1] + 1)*2 - 1<<endl;   

            }
        }
    }

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Incorrect 0 ms 384 KB Output isn't correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Incorrect 0 ms 384 KB Output isn't correct
6 Incorrect 1 ms 384 KB Output isn't correct
7 Incorrect 1 ms 384 KB Output isn't correct
8 Incorrect 1 ms 384 KB Output isn't correct
9 Incorrect 0 ms 384 KB Output isn't correct
10 Incorrect 1 ms 384 KB Output isn't correct
11 Incorrect 1 ms 384 KB Output isn't correct
12 Correct 0 ms 384 KB Output is correct
13 Incorrect 1 ms 384 KB Output isn't correct
14 Incorrect 2 ms 384 KB Output isn't correct
15 Incorrect 0 ms 384 KB Output isn't correct
16 Incorrect 1 ms 384 KB Output isn't correct
17 Incorrect 3 ms 384 KB Output isn't correct
18 Incorrect 2 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Incorrect 9 ms 1024 KB Output isn't correct
3 Correct 9 ms 896 KB Output is correct
4 Incorrect 1 ms 384 KB Output isn't correct
5 Correct 6 ms 768 KB Output is correct
6 Incorrect 1 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 1 ms 384 KB Output isn't correct
9 Incorrect 7 ms 896 KB Output isn't correct
10 Correct 7 ms 896 KB Output is correct
11 Incorrect 4 ms 640 KB Output isn't correct
12 Incorrect 1 ms 384 KB Output isn't correct
13 Incorrect 1 ms 384 KB Output isn't correct
14 Incorrect 1 ms 384 KB Output isn't correct
15 Incorrect 4 ms 640 KB Output isn't correct
16 Incorrect 9 ms 1024 KB Output isn't correct
17 Incorrect 1 ms 416 KB Output isn't correct
18 Incorrect 10 ms 1152 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 896 KB Output isn't correct
2 Incorrect 10 ms 800 KB Output isn't correct
3 Incorrect 18 ms 1024 KB Output isn't correct
4 Incorrect 17 ms 640 KB Output isn't correct
5 Incorrect 28 ms 1280 KB Output isn't correct
6 Incorrect 20 ms 768 KB Output isn't correct
7 Incorrect 20 ms 1400 KB Output isn't correct
8 Incorrect 12 ms 896 KB Output isn't correct
9 Incorrect 12 ms 896 KB Output isn't correct
10 Incorrect 4 ms 384 KB Output isn't correct
11 Incorrect 5 ms 512 KB Output isn't correct
12 Incorrect 5 ms 512 KB Output isn't correct
13 Incorrect 22 ms 896 KB Output isn't correct
14 Incorrect 19 ms 896 KB Output isn't correct
15 Incorrect 6 ms 512 KB Output isn't correct
16 Incorrect 5 ms 512 KB Output isn't correct
17 Incorrect 7 ms 768 KB Output isn't correct
18 Incorrect 9 ms 768 KB Output isn't correct
19 Incorrect 5 ms 384 KB Output isn't correct
20 Incorrect 15 ms 940 KB Output isn't correct
21 Incorrect 19 ms 1024 KB Output isn't correct
22 Incorrect 43 ms 1400 KB Output isn't correct
23 Incorrect 21 ms 896 KB Output isn't correct
24 Incorrect 18 ms 640 KB Output isn't correct
25 Incorrect 18 ms 768 KB Output isn't correct
26 Incorrect 17 ms 640 KB Output isn't correct
27 Incorrect 21 ms 1280 KB Output isn't correct
28 Incorrect 19 ms 768 KB Output isn't correct
29 Incorrect 28 ms 1400 KB Output isn't correct
30 Incorrect 25 ms 1272 KB Output isn't correct
31 Incorrect 16 ms 640 KB Output isn't correct
32 Incorrect 18 ms 768 KB Output isn't correct
33 Incorrect 17 ms 640 KB Output isn't correct
34 Incorrect 19 ms 1272 KB Output isn't correct
35 Incorrect 20 ms 768 KB Output isn't correct
36 Incorrect 27 ms 1280 KB Output isn't correct
37 Incorrect 28 ms 1272 KB Output isn't correct
38 Incorrect 18 ms 768 KB Output isn't correct
39 Incorrect 19 ms 768 KB Output isn't correct
40 Incorrect 19 ms 760 KB Output isn't correct
41 Correct 22 ms 1280 KB Output is correct
42 Incorrect 20 ms 768 KB Output isn't correct