# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
31942 | 2017-09-17T14:35:54 Z | Extazy | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 0 ms | 1844 KB |
#include <bits/stdc++.h> #define endl '\n' #define left aklhgjqghkqkj #define right ajklvhajkvhajk #define prev aioghajga #define next ioyhjhfajasj #define y0 iuadoghasdgj #define y1 taklahgjkla #define remainder pogjuakllhga #define pow pajklgaklha #define pow10 iopuioadjlgkah #define div aljghajkghak #define distance gkuftgjasgfjh #define uppercase ifyhasjkhakjfas #define tm aogqjgklqjgqklgjqlkq //#define floor hjakjhaja //#define time ashjlahjka //#define double_t double using namespace std; const int N = 1<<17; const int TO = (1e7); const int INF = (1e9) + 7; multiset < int > s; vector < int > div[TO + 7]; int dp[TO + 7]; int sv[TO + 7]; int n,q; int mx; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int i,j,x; multiset < int >::iterator it; scanf("%d %d", &n, &q); for(i=1;i<=n;i++) { scanf("%d", &x); mx=max(mx,x); if(!div[x].empty()) continue; for(j=x;j<=TO;j+=x) { div[j].push_back(x); } } for(i=1;i<=TO;i++) { for(j=0;j<(int)(div[i].size());j++) { if(div[i][j]!=i) { if((it=s.find(dp[sv[div[i][j]]]))!=s.end()) { s.erase(it); //s.erase(s.find(dp[sv[div[i][j]]])); } } } if(i<mx) dp[i]=1; else if(s.empty()) dp[i]=INF; else dp[i]=1+(*s.begin()); dp[i]=min(dp[i],INF); for(j=0;j<(int)(div[i].size());j++) { sv[div[i][j]]=i; s.insert(dp[i]); } while(s.size()>7) { it=s.end(); --it; s.erase(it); } } while(q--) { scanf("%d", &x); if(dp[x]==INF) printf("oo\n"); else printf("%d\n", dp[x]); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
19 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
20 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
21 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
22 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
23 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
24 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
25 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
26 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
27 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
28 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
29 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
30 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
31 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
32 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
33 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
34 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
35 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
36 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
37 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
38 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
39 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
40 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
41 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
42 | Runtime error | 0 ms | 1844 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |