# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
31896 | 2017-09-12T14:43:27 Z | chonka | Brunhilda’s Birthday (BOI13_brunhilda) | C++ | 123 ms | 43196 KB |
#include<iostream> #include<stdio.h> #include<vector> #include<queue> using namespace std ; #define MAXN 100007 int n , m ; int a[ MAXN ] ; int b[ MAXN ] ; int ans[ 100 * MAXN ] ; int akt[ MAXN ] ; int lim ; void input ( ) { scanf ( "%d%d" , &n , &m ) ; int i ; for ( i = 1 ; i <= n ; i ++ ) { scanf ( "%d" , &a[ i ] ) ; } } void solve ( ) { lim = 1 ; int i , j ; for ( i = 1 ; i <= 7 ; i ++ ) { lim *= 10 ; } deque < pair < int , int > > q ; long long prod = 1 ; for ( i = 1 ; i <= n ; i ++ ) { prod *= a[ i ] ; if ( prod > lim ) { prod = lim + 1 ; } q.push_front ( make_pair ( 0 , i ) ) ; akt[ i ] = 0 ; } for ( i = 1 ; i <= lim ; i ++ ) { if ( i >= prod ) { ans[ i ] = -1 ; continue ; } while ( q.empty ( ) == false ) { pair < int , int > p = q.back ( ) ; if ( p.first + a[ p.second ] <= i ) { q.push_front ( make_pair ( p.first + a[ p.second ] , p.second ) ) ; q.pop_back ( ) ; } else { break ; } } ans[ i ] = ans[ (q.back()).first ] + 1 ; } while ( m != 0 ) { m -- ; int x ; scanf ( "%d" , &x ) ; if ( ans[ x ] != -1 ) { printf ( "%d\n" , ans[ x ] ) ; } else { printf ( "oo\n" ) ; } } } int main ( ) { input ( ) ; solve ( ) ; return 0 ; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 42252 KB | Output isn't correct |
2 | Incorrect | 43 ms | 42252 KB | Output isn't correct |
3 | Incorrect | 9 ms | 42252 KB | Output isn't correct |
4 | Incorrect | 43 ms | 42252 KB | Output isn't correct |
5 | Correct | 39 ms | 42252 KB | Output is correct |
6 | Incorrect | 9 ms | 42252 KB | Output isn't correct |
7 | Incorrect | 19 ms | 42252 KB | Output isn't correct |
8 | Incorrect | 9 ms | 42252 KB | Output isn't correct |
9 | Incorrect | 56 ms | 42252 KB | Output isn't correct |
10 | Incorrect | 46 ms | 42252 KB | Output isn't correct |
11 | Incorrect | 53 ms | 42252 KB | Output isn't correct |
12 | Correct | 36 ms | 42252 KB | Output is correct |
13 | Correct | 43 ms | 42252 KB | Output is correct |
14 | Correct | 49 ms | 42252 KB | Output is correct |
15 | Incorrect | 49 ms | 42252 KB | Output isn't correct |
16 | Incorrect | 39 ms | 42252 KB | Output isn't correct |
17 | Incorrect | 49 ms | 42252 KB | Output isn't correct |
18 | Incorrect | 29 ms | 42252 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 56 ms | 42384 KB | Output is correct |
2 | Correct | 56 ms | 43044 KB | Output is correct |
3 | Incorrect | 56 ms | 42912 KB | Output isn't correct |
4 | Incorrect | 43 ms | 42252 KB | Output isn't correct |
5 | Correct | 56 ms | 42648 KB | Output is correct |
6 | Correct | 59 ms | 42252 KB | Output is correct |
7 | Correct | 46 ms | 42384 KB | Output is correct |
8 | Incorrect | 33 ms | 42252 KB | Output isn't correct |
9 | Correct | 56 ms | 42912 KB | Output is correct |
10 | Incorrect | 59 ms | 42912 KB | Output isn't correct |
11 | Incorrect | 59 ms | 42648 KB | Output isn't correct |
12 | Incorrect | 59 ms | 42252 KB | Output isn't correct |
13 | Correct | 46 ms | 42252 KB | Output is correct |
14 | Incorrect | 33 ms | 42252 KB | Output isn't correct |
15 | Correct | 63 ms | 42648 KB | Output is correct |
16 | Correct | 56 ms | 43044 KB | Output is correct |
17 | Incorrect | 33 ms | 42252 KB | Output isn't correct |
18 | Incorrect | 63 ms | 43196 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 76 ms | 42648 KB | Output is correct |
2 | Correct | 86 ms | 42784 KB | Output is correct |
3 | Incorrect | 73 ms | 42648 KB | Output isn't correct |
4 | Incorrect | 86 ms | 42252 KB | Output isn't correct |
5 | Correct | 119 ms | 43188 KB | Output is correct |
6 | Incorrect | 83 ms | 42384 KB | Output isn't correct |
7 | Correct | 86 ms | 43196 KB | Output is correct |
8 | Correct | 83 ms | 42648 KB | Output is correct |
9 | Correct | 76 ms | 42648 KB | Output is correct |
10 | Incorrect | 36 ms | 42384 KB | Output isn't correct |
11 | Incorrect | 53 ms | 42252 KB | Output isn't correct |
12 | Incorrect | 59 ms | 42384 KB | Output isn't correct |
13 | Incorrect | 69 ms | 42516 KB | Output isn't correct |
14 | Incorrect | 86 ms | 42252 KB | Output isn't correct |
15 | Incorrect | 69 ms | 42252 KB | Output isn't correct |
16 | Incorrect | 39 ms | 42384 KB | Output isn't correct |
17 | Correct | 53 ms | 42648 KB | Output is correct |
18 | Correct | 79 ms | 42784 KB | Output is correct |
19 | Correct | 49 ms | 42252 KB | Output is correct |
20 | Incorrect | 79 ms | 42648 KB | Output isn't correct |
21 | Incorrect | 76 ms | 42252 KB | Output isn't correct |
22 | Correct | 116 ms | 43196 KB | Output is correct |
23 | Correct | 76 ms | 42516 KB | Output is correct |
24 | Incorrect | 83 ms | 42252 KB | Output isn't correct |
25 | Incorrect | 89 ms | 42252 KB | Output isn't correct |
26 | Incorrect | 106 ms | 42252 KB | Output isn't correct |
27 | Incorrect | 76 ms | 43196 KB | Output isn't correct |
28 | Incorrect | 66 ms | 42252 KB | Output isn't correct |
29 | Correct | 119 ms | 43196 KB | Output is correct |
30 | Correct | 123 ms | 42912 KB | Output is correct |
31 | Correct | 59 ms | 42252 KB | Output is correct |
32 | Incorrect | 83 ms | 42252 KB | Output isn't correct |
33 | Incorrect | 83 ms | 42252 KB | Output isn't correct |
34 | Correct | 76 ms | 43196 KB | Output is correct |
35 | Incorrect | 66 ms | 42252 KB | Output isn't correct |
36 | Correct | 106 ms | 43044 KB | Output is correct |
37 | Correct | 123 ms | 43188 KB | Output is correct |
38 | Incorrect | 103 ms | 42384 KB | Output isn't correct |
39 | Incorrect | 89 ms | 42252 KB | Output isn't correct |
40 | Correct | 79 ms | 42384 KB | Output is correct |
41 | Correct | 79 ms | 43196 KB | Output is correct |
42 | Incorrect | 69 ms | 42252 KB | Output isn't correct |