# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
230226 | 2020-05-09T09:01:07 Z | kshitij_sodani | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 302 ms | 262148 KB |
#include <iostream> #include <bits/stdc++.h> using namespace std; typedef int64_t llo; #define mp make_pair #define pb push_back #define a first #define b second int ma[100001]; int dp[10000001]; vector<int> fac[10000001]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n,s; cin>>n>>s; int aa; dp[1]=1; dp[0]=0; priority_queue<pair<int,int>> ac; int it[n]; for(int i=0;i<n;i++){ cin>>it[i]; ac.push({1,i}); ma[i]=1; } for(int i=0;i<n;i++){ for(int j=it[i];j<10000001;j+=it[i]){ fac[j].pb(i); } } int co=1; for(int j=2;j<10000001;j++){ for(auto k:fac[j]){ ma[k]=-co; ac.push({-co,k}); } int prev=j; while(ac.size()){ pair<int,int> x=ac.top(); if(ma[x.b]!=x.a){ ac.pop(); continue; } prev=j-(x.a+co); break; } if(prev==j){ dp[j]=-1; } else if(dp[prev]!=-1){ dp[j]=dp[prev]+1; } else{ dp[j]=-1; } co+=1; } while(s--){ cin>>aa; if(dp[aa]==-1){ cout<<"oo"<<endl; } else{ cout<<dp[aa]<<endl; } } return 0; }
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 166 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 156 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 159 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 250 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 166 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 170 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 164 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 173 ms | 262148 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 | 158 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 158 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 252 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 154 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 150 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 156 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 158 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 188 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 241 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 259 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 203 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 169 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 164 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 161 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 156 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 252 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 160 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 168 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 175 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 164 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 157 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 158 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 160 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 173 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 205 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 159 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 177 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 162 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 168 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 158 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 294 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 157 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 187 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 168 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 169 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 156 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 167 ms | 262148 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 | 157 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 162 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 166 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 167 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 174 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 173 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
19 | Runtime error | 169 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
20 | Runtime error | 174 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
21 | Runtime error | 166 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
22 | Runtime error | 177 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
23 | Runtime error | 302 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
24 | Runtime error | 176 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
25 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
26 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
27 | Runtime error | 180 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
28 | Runtime error | 157 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
29 | Runtime error | 175 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
30 | Runtime error | 189 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
31 | Runtime error | 167 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
32 | Runtime error | 177 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
33 | Runtime error | 216 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
34 | Runtime error | 191 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
35 | Runtime error | 163 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
36 | Runtime error | 177 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
37 | Runtime error | 301 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
38 | Runtime error | 165 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
39 | Runtime error | 189 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Runtime error | 159 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
41 | Runtime error | 177 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
42 | Runtime error | 157 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |