# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
243607 | 2020-07-01T11:59:06 Z | anubhavdhar | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 315 ms | 262148 KB |
#include<bits/stdc++.h> #define ll long long int #define pb push_back #define mp make_pair #define FOR(i,n) for(i=0;i<(n);++i) #define FORe(i,n) for(i=1;i<=(n);++i) #define FORr(i,a,b) for(i=(a);i<(b);++i) #define FORrev(i,n) for(i=(n);i>=0;--i) #define F0R(i,n) for(int i=0;i<(n);++i) #define F0Re(i,n) for(int i=1;i<=(n);++i) #define F0Rr(i,a,b) for(ll i=(a);i<(b);++i) #define F0Rrev(i,n) for(int i=(n);i>=0;--i) #define ii pair<ll,ll> #define vi vector<ll> #define vii vector<ii> #define ff first #define ss second #define cd complex<double> #define vcd vector<cd> #define ldd long double #define dbgLine cout<<"Line : "<<__LINE__<<'\n' #define all(x) (x).begin(),(x).end() using namespace std; const short int __PRECISION = 10; const ll MOD = 1e9+7; const ll INF = 1e17 + 1101; const ll LOGN = 17; const ll MAXN = 1e7+5; const ll ROOTN = 320; const ldd PI = acos(-1); const ldd EPS = 1e-7; const int inf = 1e9 + 4; int dp[MAXN], m, Q, p[MAXN]; vector<int> g[MAXN]; inline void init() { cin>>m>>Q; F0R(i, m) cin>>p[i]; sort(p, p + m); F0R(i, m) for(int j = p[i]; j < MAXN; j += p[i]) g[j].pb(i); dp[0] = 0; dp[1] = 1; multiset<int> S; int curr[m], mex = MAXN; F0R(i, m) S.insert(0), curr[i] = 0; F0Rr(i, 2, MAXN) { for(int j : g[i]) { S.erase(S.find(curr[j])); curr[j] = i; S.insert(i); } if(0 != *(S.begin()) and *(S.begin()) == *(S.rbegin())) { mex = i; break; } dp[i] = 1 + dp[*(S.begin())]; } F0Rr(i, mex, MAXN) dp[i] = inf; // dbgLine; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; init(); F0Re(i, Q) { // n = i;cout<<"ans("<<i<<") = "; cin>>n; if(dp[n] < inf) cout<<dp[n]<<'\n'; else cout<<"oo\n"; } return 0; }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 180 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 163 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 | 252 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 167 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 173 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 162 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 160 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 162 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 152 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
12 | Runtime error | 298 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 164 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 155 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 163 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 178 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 253 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 246 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 201 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Runtime error | 168 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
4 | Runtime error | 157 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 | 156 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Runtime error | 245 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
8 | Runtime error | 164 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 171 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 170 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
11 | Runtime error | 171 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 | 160 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 168 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
15 | Runtime error | 163 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
16 | Runtime error | 193 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 157 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 180 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 173 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Runtime error | 182 ms | 262148 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 | 163 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
5 | Runtime error | 295 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
6 | Runtime error | 173 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 | 165 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
9 | Runtime error | 166 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
10 | Runtime error | 161 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 | 162 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
13 | Runtime error | 175 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
14 | Runtime error | 158 ms | 262144 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 | 163 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
17 | Runtime error | 171 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
18 | Runtime error | 158 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
19 | Runtime error | 155 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
20 | Runtime error | 169 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
21 | Runtime error | 156 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
22 | Runtime error | 174 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
23 | Runtime error | 284 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 | 163 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
26 | Runtime error | 166 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
27 | Runtime error | 178 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
28 | Runtime error | 170 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 | 174 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
31 | Runtime error | 164 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
32 | Runtime error | 155 ms | 262144 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
33 | Runtime error | 221 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
34 | Runtime error | 178 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
35 | Runtime error | 154 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
36 | Runtime error | 173 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
37 | Runtime error | 315 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
38 | Runtime error | 154 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
39 | Runtime error | 193 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Runtime error | 165 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
41 | Runtime error | 178 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
42 | Runtime error | 161 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |