# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
722041 | 2023-04-11T10:47:57 Z | PoPularPlusPlus | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 44 ms | 20808 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define pb(e) push_back(e) #define sv(a) sort(a.begin(),a.end()) #define sa(a,n) sort(a,a+n) #define mp(a,b) make_pair(a,b) #define vf first #define vs second #define ar array #define all(x) x.begin(),x.end() const int inf = 0x3f3f3f3f; const int mod = 1000000007; const double PI=3.14159265358979323846264338327950288419716939937510582097494459230; mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count()); bool remender(ll a , ll b){return a%b;} //freopen("problemname.in", "r", stdin); //freopen("problemname.out", "w", stdout); const int N = 100002; int ans[N]; vector<int> v[N]; void solve(){ int n , qu; cin >> n >> qu; int arr[n]; for(int i = 0; i < n; i++)cin >> arr[i]; int mx = 0; for(int i = 0; i < n; i++)mx = max(mx , arr[i]); for(int i = 0; i < n; i++){ for(int j = arr[i]; j <= N-2; j+=arr[i]){ v[j].pb(i); } } int cur[n]; queue<pair<int,int>> q; for(int i = 0; i < n; i++){ cur[i] = 0; q.push(mp(0,i)); } ans[0] = 0; for(int i = 1; i <= N-2; i++){ ans[i] = 1e9; for(int j : v[i]){ q.push(mp(i,j)); cur[j] = i; } while(q.size()){ pair<int,int> p = q.front(); if(cur[p.vs] == p.vf)break; q.pop(); } ans[i] = ans[q.front().vf]+1; } while(qu--){ int x; cin >> x; if(ans[x] >= 1e9)cout << "oo\n"; else cout << ans[x] << '\n'; } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // int t;cin>>t; // while(t--){ solve(); //} return 0; }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3540 KB | Output is correct |
2 | Correct | 8 ms | 5252 KB | Output is correct |
3 | Correct | 7 ms | 4948 KB | Output is correct |
4 | Correct | 4 ms | 3284 KB | Output is correct |
5 | Correct | 5 ms | 3796 KB | Output is correct |
6 | Correct | 4 ms | 3540 KB | Output is correct |
7 | Correct | 7 ms | 4988 KB | Output is correct |
8 | Correct | 11 ms | 5412 KB | Output is correct |
9 | Correct | 13 ms | 5688 KB | Output is correct |
10 | Correct | 12 ms | 5716 KB | Output is correct |
11 | Correct | 11 ms | 5204 KB | Output is correct |
12 | Correct | 4 ms | 3156 KB | Output is correct |
13 | Correct | 16 ms | 6100 KB | Output is correct |
14 | Correct | 17 ms | 6208 KB | Output is correct |
15 | Correct | 9 ms | 5204 KB | Output is correct |
16 | Correct | 9 ms | 5332 KB | Output is correct |
17 | Correct | 6 ms | 3924 KB | Output is correct |
18 | Correct | 5 ms | 3284 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 10 ms | 7508 KB | Execution killed with signal 11 |
2 | Runtime error | 22 ms | 11108 KB | Execution killed with signal 11 |
3 | Incorrect | 26 ms | 9692 KB | Output isn't correct |
4 | Runtime error | 13 ms | 9556 KB | Execution killed with signal 11 |
5 | Runtime error | 23 ms | 15188 KB | Execution killed with signal 11 |
6 | Runtime error | 11 ms | 10804 KB | Execution killed with signal 11 |
7 | Runtime error | 8 ms | 7512 KB | Execution killed with signal 11 |
8 | Runtime error | 10 ms | 8640 KB | Execution killed with signal 11 |
9 | Runtime error | 25 ms | 16700 KB | Execution killed with signal 11 |
10 | Runtime error | 35 ms | 19124 KB | Execution killed with signal 11 |
11 | Runtime error | 35 ms | 17864 KB | Execution killed with signal 11 |
12 | Runtime error | 19 ms | 12024 KB | Execution killed with signal 11 |
13 | Runtime error | 8 ms | 8020 KB | Execution killed with signal 11 |
14 | Runtime error | 11 ms | 9524 KB | Execution killed with signal 11 |
15 | Runtime error | 31 ms | 16864 KB | Execution killed with signal 11 |
16 | Runtime error | 22 ms | 11092 KB | Execution killed with signal 11 |
17 | Runtime error | 24 ms | 14656 KB | Execution killed with signal 11 |
18 | Runtime error | 30 ms | 18128 KB | Execution killed with signal 11 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 33 ms | 17612 KB | Execution killed with signal 11 |
2 | Runtime error | 36 ms | 18508 KB | Execution killed with signal 11 |
3 | Runtime error | 44 ms | 18620 KB | Execution killed with signal 11 |
4 | Runtime error | 17 ms | 13592 KB | Execution killed with signal 11 |
5 | Runtime error | 24 ms | 11220 KB | Execution killed with signal 11 |
6 | Runtime error | 23 ms | 15624 KB | Execution killed with signal 11 |
7 | Runtime error | 27 ms | 15780 KB | Execution killed with signal 11 |
8 | Runtime error | 35 ms | 17596 KB | Execution killed with signal 11 |
9 | Runtime error | 31 ms | 17732 KB | Execution killed with signal 11 |
10 | Runtime error | 22 ms | 13128 KB | Execution killed with signal 11 |
11 | Runtime error | 18 ms | 11620 KB | Execution killed with signal 11 |
12 | Runtime error | 29 ms | 15276 KB | Execution killed with signal 11 |
13 | Runtime error | 26 ms | 17012 KB | Execution killed with signal 11 |
14 | Runtime error | 16 ms | 11528 KB | Execution killed with signal 11 |
15 | Runtime error | 25 ms | 15296 KB | Execution killed with signal 11 |
16 | Runtime error | 23 ms | 15736 KB | Execution killed with signal 11 |
17 | Runtime error | 26 ms | 15556 KB | Execution killed with signal 11 |
18 | Runtime error | 44 ms | 18608 KB | Execution killed with signal 11 |
19 | Runtime error | 10 ms | 9604 KB | Execution killed with signal 11 |
20 | Runtime error | 37 ms | 18460 KB | Execution killed with signal 11 |
21 | Runtime error | 18 ms | 11732 KB | Execution killed with signal 11 |
22 | Runtime error | 34 ms | 20248 KB | Execution killed with signal 11 |
23 | Runtime error | 12 ms | 8788 KB | Execution killed with signal 11 |
24 | Runtime error | 7 ms | 7568 KB | Execution killed with signal 11 |
25 | Runtime error | 18 ms | 12460 KB | Execution killed with signal 11 |
26 | Runtime error | 23 ms | 13648 KB | Execution killed with signal 11 |
27 | Runtime error | 36 ms | 20808 KB | Execution killed with signal 11 |
28 | Runtime error | 8 ms | 9044 KB | Execution killed with signal 11 |
29 | Runtime error | 39 ms | 17940 KB | Execution killed with signal 11 |
30 | Runtime error | 29 ms | 15992 KB | Execution killed with signal 11 |
31 | Runtime error | 10 ms | 9348 KB | Execution killed with signal 11 |
32 | Runtime error | 12 ms | 10184 KB | Execution killed with signal 11 |
33 | Runtime error | 7 ms | 6852 KB | Execution killed with signal 11 |
34 | Runtime error | 28 ms | 15776 KB | Execution killed with signal 11 |
35 | Runtime error | 13 ms | 9196 KB | Execution killed with signal 11 |
36 | Runtime error | 36 ms | 19828 KB | Execution killed with signal 11 |
37 | Runtime error | 19 ms | 11220 KB | Execution killed with signal 11 |
38 | Runtime error | 23 ms | 15580 KB | Execution killed with signal 11 |
39 | Runtime error | 8 ms | 8020 KB | Execution killed with signal 11 |
40 | Runtime error | 19 ms | 14548 KB | Execution killed with signal 11 |
41 | Runtime error | 30 ms | 17004 KB | Execution killed with signal 11 |
42 | Runtime error | 22 ms | 14348 KB | Execution killed with signal 11 |