# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
31894 | 2017-09-12T14:37:09 Z | chonka | Brunhilda’s Birthday (BOI13_brunhilda) | C++ | 119 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 ; for ( i = 1 ; i <= n ; i ++ ) { q.push_front ( make_pair ( 0 , i ) ) ; akt[ i ] = 0 ; } for ( i = 1 ; i <= lim ; i ++ ) { 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 ; if ( ans[ q.back().first ] == -1 || (q.back()).first == i ) { ans[ i ] = -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 | 76 ms | 42252 KB | Output isn't correct |
2 | Incorrect | 79 ms | 42252 KB | Output isn't correct |
3 | Incorrect | 56 ms | 42252 KB | Output isn't correct |
4 | Incorrect | 39 ms | 42252 KB | Output isn't correct |
5 | Correct | 56 ms | 42252 KB | Output is correct |
6 | Incorrect | 69 ms | 42252 KB | Output isn't correct |
7 | Incorrect | 49 ms | 42252 KB | Output isn't correct |
8 | Incorrect | 43 ms | 42252 KB | Output isn't correct |
9 | Incorrect | 59 ms | 42252 KB | Output isn't correct |
10 | Incorrect | 59 ms | 42252 KB | Output isn't correct |
11 | Incorrect | 49 ms | 42252 KB | Output isn't correct |
12 | Correct | 56 ms | 42252 KB | Output is correct |
13 | Correct | 56 ms | 42252 KB | Output is correct |
14 | Correct | 46 ms | 42252 KB | Output is correct |
15 | Incorrect | 53 ms | 42252 KB | Output isn't correct |
16 | Incorrect | 46 ms | 42252 KB | Output isn't correct |
17 | Incorrect | 56 ms | 42252 KB | Output isn't correct |
18 | Incorrect | 33 ms | 42252 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 42384 KB | Output is correct |
2 | Correct | 76 ms | 43044 KB | Output is correct |
3 | Incorrect | 53 ms | 42912 KB | Output isn't correct |
4 | Incorrect | 39 ms | 42252 KB | Output isn't correct |
5 | Correct | 56 ms | 42648 KB | Output is correct |
6 | Correct | 39 ms | 42252 KB | Output is correct |
7 | Correct | 33 ms | 42384 KB | Output is correct |
8 | Incorrect | 36 ms | 42252 KB | Output isn't correct |
9 | Correct | 49 ms | 42912 KB | Output is correct |
10 | Incorrect | 53 ms | 42912 KB | Output isn't correct |
11 | Incorrect | 49 ms | 42648 KB | Output isn't correct |
12 | Incorrect | 46 ms | 42252 KB | Output isn't correct |
13 | Correct | 39 ms | 42252 KB | Output is correct |
14 | Incorrect | 36 ms | 42252 KB | Output isn't correct |
15 | Correct | 56 ms | 42648 KB | Output is correct |
16 | Correct | 76 ms | 43044 KB | Output is correct |
17 | Incorrect | 39 ms | 42252 KB | Output isn't correct |
18 | Incorrect | 73 ms | 43196 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 66 ms | 42648 KB | Output is correct |
2 | Correct | 63 ms | 42784 KB | Output is correct |
3 | Incorrect | 76 ms | 42648 KB | Output isn't correct |
4 | Incorrect | 89 ms | 42252 KB | Output isn't correct |
5 | Correct | 96 ms | 43188 KB | Output is correct |
6 | Incorrect | 89 ms | 42384 KB | Output isn't correct |
7 | Correct | 69 ms | 43196 KB | Output is correct |
8 | Correct | 66 ms | 42648 KB | Output is correct |
9 | Correct | 83 ms | 42648 KB | Output is correct |
10 | Incorrect | 56 ms | 42384 KB | Output isn't correct |
11 | Incorrect | 43 ms | 42252 KB | Output isn't correct |
12 | Incorrect | 43 ms | 42384 KB | Output isn't correct |
13 | Incorrect | 76 ms | 42516 KB | Output isn't correct |
14 | Incorrect | 99 ms | 42252 KB | Output isn't correct |
15 | Incorrect | 63 ms | 42252 KB | Output isn't correct |
16 | Incorrect | 76 ms | 42384 KB | Output isn't correct |
17 | Correct | 59 ms | 42648 KB | Output is correct |
18 | Correct | 83 ms | 42784 KB | Output is correct |
19 | Correct | 59 ms | 42252 KB | Output is correct |
20 | Incorrect | 63 ms | 42648 KB | Output isn't correct |
21 | Incorrect | 66 ms | 42252 KB | Output isn't correct |
22 | Correct | 119 ms | 43196 KB | Output is correct |
23 | Correct | 93 ms | 42516 KB | Output is correct |
24 | Incorrect | 103 ms | 42252 KB | Output isn't correct |
25 | Incorrect | 89 ms | 42252 KB | Output isn't correct |
26 | Incorrect | 73 ms | 42252 KB | Output isn't correct |
27 | Incorrect | 79 ms | 43196 KB | Output isn't correct |
28 | Incorrect | 56 ms | 42252 KB | Output isn't correct |
29 | Correct | 96 ms | 43196 KB | Output is correct |
30 | Correct | 93 ms | 42912 KB | Output is correct |
31 | Correct | 79 ms | 42252 KB | Output is correct |
32 | Incorrect | 73 ms | 42252 KB | Output isn't correct |
33 | Incorrect | 69 ms | 42252 KB | Output isn't correct |
34 | Correct | 83 ms | 43196 KB | Output is correct |
35 | Incorrect | 56 ms | 42252 KB | Output isn't correct |
36 | Correct | 89 ms | 43044 KB | Output is correct |
37 | Correct | 83 ms | 43188 KB | Output is correct |
38 | Incorrect | 93 ms | 42384 KB | Output isn't correct |
39 | Incorrect | 73 ms | 42252 KB | Output isn't correct |
40 | Correct | 89 ms | 42384 KB | Output is correct |
41 | Correct | 76 ms | 43196 KB | Output is correct |
42 | Incorrect | 43 ms | 42252 KB | Output isn't correct |