# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
243399 | 2020-07-01T02:44:19 Z | Lawliet | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 288 ms | 262148 KB |
#include <bits/stdc++.h> using namespace std; const int MAXM = 100010; const int MAXN = 10000010; const int INF = 1000000010; int m, q; int v[MAXM]; int dp[MAXN]; vector<int> d[MAXN]; vector<int> multiples[MAXM]; int main() { scanf("%d %d",&m,&q); for(int i = 1 ; i <= m ; i++) scanf("%d",&v[i]); for(int i = 1 ; i <= m ; i++) { for(int cur = v[i] ; cur < MAXN ; cur += v[i]) { d[cur].push_back( i ); multiples[i].push_back( cur ); } } int mn = INF; for(int i = 1 ; i <= m ; i++) mn = min( mn , 10000000 - (10000000%v[i]) ); for(int i = MAXN - 1 ; i > 0 ; i--) { dp[i] = mn; for(int j = 0 ; j < (int)d[i].size() ; j++) { int curPrime = d[i][j]; multiples[curPrime].pop_back(); mn = min( mn , multiples[curPrime].back() ); } } for(int i = 1 ; i < MAXN ; i++) { if( dp[i] == i ) dp[i] = INF; else dp[i] = dp[ dp[i] ] + 1; } for(int i = 1 ; i <= q ; i++) { int p; scanf("%d",&p); if( dp[p] >= INF ) printf("oo\n"); else printf("%d\n",dp[p]); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 177 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 157 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 242 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 173 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 166 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 156 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 152 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 159 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 177 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 167 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 238 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 179 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 164 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 172 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 177 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 247 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 225 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 191 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 171 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 166 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 165 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 158 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 233 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 164 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 162 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 180 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 173 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 159 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 173 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 156 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 162 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 189 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 158 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 176 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 167 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 166 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 165 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 275 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 162 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 181 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 172 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 162 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 159 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 160 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 166 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 163 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 167 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 156 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 166 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 160 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 166 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
19 | Runtime error | 159 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
20 | Runtime error | 174 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
21 | Runtime error | 159 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
22 | Runtime error | 175 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
23 | Runtime error | 265 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
24 | Runtime error | 169 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
25 | Runtime error | 158 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
26 | Runtime error | 158 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
27 | Runtime error | 179 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
28 | Runtime error | 152 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
29 | Runtime error | 177 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
30 | Runtime error | 184 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
31 | Runtime error | 156 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
32 | Runtime error | 156 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
33 | Runtime error | 179 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
34 | Runtime error | 184 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
35 | Runtime error | 159 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
36 | Runtime error | 174 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
37 | Runtime error | 288 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
38 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
39 | Runtime error | 165 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Runtime error | 160 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
41 | Runtime error | 176 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
42 | Runtime error | 154 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |