# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
243608 | 2020-07-01T12:00:03 Z | anubhavdhar | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 330 ms | 24312 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 = 1e5+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; }
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 3584 KB | Output is correct |
2 | Correct | 26 ms | 5376 KB | Output is correct |
3 | Correct | 18 ms | 4992 KB | Output is correct |
4 | Correct | 33 ms | 3328 KB | Output is correct |
5 | Correct | 13 ms | 3840 KB | Output is correct |
6 | Correct | 10 ms | 3712 KB | Output is correct |
7 | Correct | 18 ms | 4992 KB | Output is correct |
8 | Correct | 22 ms | 5376 KB | Output is correct |
9 | Correct | 30 ms | 5632 KB | Output is correct |
10 | Correct | 36 ms | 5752 KB | Output is correct |
11 | Correct | 30 ms | 5376 KB | Output is correct |
12 | Correct | 9 ms | 3200 KB | Output is correct |
13 | Correct | 72 ms | 6008 KB | Output is correct |
14 | Correct | 97 ms | 6136 KB | Output is correct |
15 | Correct | 26 ms | 5240 KB | Output is correct |
16 | Correct | 26 ms | 5376 KB | Output is correct |
17 | Correct | 40 ms | 3968 KB | Output is correct |
18 | Correct | 32 ms | 3328 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 27 ms | 8320 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 93 ms | 18072 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 167 ms | 20600 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 31 ms | 9088 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 104 ms | 17148 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 25 ms | 9984 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 25 ms | 8312 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 25 ms | 8576 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 125 ms | 20064 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 168 ms | 20600 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 136 ms | 17020 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 49 ms | 11256 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 18 ms | 7808 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 31 ms | 9084 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Incorrect | 108 ms | 8568 KB | Output isn't correct |
16 | Runtime error | 91 ms | 18044 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 79 ms | 12408 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 158 ms | 23672 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 140 ms | 18040 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 146 ms | 18552 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 139 ms | 18424 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 47 ms | 11640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 95 ms | 18684 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 72 ms | 13048 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 124 ms | 22264 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 137 ms | 18044 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 131 ms | 18040 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 51 ms | 11768 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 40 ms | 10624 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 68 ms | 12664 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Incorrect | 330 ms | 8952 KB | Output isn't correct |
14 | Runtime error | 44 ms | 11512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 77 ms | 12792 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 93 ms | 13052 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 101 ms | 16812 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 155 ms | 18708 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
19 | Runtime error | 29 ms | 9216 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
20 | Runtime error | 147 ms | 18412 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
21 | Runtime error | 59 ms | 11768 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
22 | Runtime error | 194 ms | 24184 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
23 | Runtime error | 45 ms | 11000 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
24 | Runtime error | 17 ms | 7296 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
25 | Runtime error | 53 ms | 11640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
26 | Runtime error | 54 ms | 11768 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
27 | Runtime error | 205 ms | 24312 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
28 | Runtime error | 21 ms | 8448 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
29 | Runtime error | 147 ms | 23800 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
30 | Runtime error | 112 ms | 19836 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
31 | Runtime error | 27 ms | 8960 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
32 | Runtime error | 32 ms | 9600 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
33 | Runtime error | 15 ms | 6784 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
34 | Runtime error | 128 ms | 22264 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
35 | Runtime error | 24 ms | 8696 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
36 | Runtime error | 180 ms | 23032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
37 | Runtime error | 97 ms | 18680 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
38 | Runtime error | 84 ms | 13176 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
39 | Runtime error | 20 ms | 7808 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
40 | Runtime error | 65 ms | 13048 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
41 | Runtime error | 141 ms | 23036 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
42 | Runtime error | 90 ms | 12408 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |