# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
925378 | 2024-02-11T13:57:58 Z | 8pete8 | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 204 ms | 80064 KB |
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<cassert> #include<limits.h> #include<cmath> #include<set> #include<numeric> //gcd(a,b) #include<algorithm> #include<bitset> #include<stack> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define pppiiii pair<pii,pii> #define ppii pair<int,pii> #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize ("03,unroll-loops") //#define int long long const int mod=1e9+7,mxn=1e7+100000,lg=30;//inf=1e18,minf=-1e18,Mxn=100000,root=700; void setIO(string name){ ios_base::sync_with_stdio(0); cin.tie(0); freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } int n,q; int ans[mxn+10],mx[mxn+10]; int32_t main(){ //setIO("redistricting"); fastio cin>>n>>q; vector<int>v(n); for(int i=0;i<n;i++)cin>>v[i]; sort(all(v)); v.erase(unique(all(v)),v.end()); for(auto i:v)for(int j=i-1;j<=mxn;j+=i)mx[j]=max(mx[j],i-1); for(int i=mxn;i>=0;i--)mx[i]=max(mx[i],mx[i+1]-1); for(int i=1;i<=mxn;i++){ ans[i]=ans[i-mx[i]]; if(ans[i]!=-1)ans[i]++; if(mx[i]<=0)ans[i]=-1; } while(q--){ int g;cin>>g; if(ans[g]!=-1)cout<<ans[g]<<'\n'; else cout<<"oo"<<'\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 79440 KB | Output is correct |
2 | Correct | 61 ms | 79332 KB | Output is correct |
3 | Correct | 59 ms | 79408 KB | Output is correct |
4 | Correct | 49 ms | 79700 KB | Output is correct |
5 | Correct | 55 ms | 79412 KB | Output is correct |
6 | Correct | 51 ms | 79444 KB | Output is correct |
7 | Correct | 59 ms | 79444 KB | Output is correct |
8 | Correct | 62 ms | 79408 KB | Output is correct |
9 | Correct | 72 ms | 79440 KB | Output is correct |
10 | Correct | 84 ms | 79312 KB | Output is correct |
11 | Correct | 71 ms | 79416 KB | Output is correct |
12 | Correct | 47 ms | 79424 KB | Output is correct |
13 | Correct | 123 ms | 79444 KB | Output is correct |
14 | Correct | 134 ms | 79368 KB | Output is correct |
15 | Correct | 65 ms | 79440 KB | Output is correct |
16 | Correct | 60 ms | 79412 KB | Output is correct |
17 | Correct | 59 ms | 79428 KB | Output is correct |
18 | Correct | 51 ms | 79324 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 56 ms | 79452 KB | Output is correct |
2 | Correct | 67 ms | 79696 KB | Output is correct |
3 | Correct | 161 ms | 79684 KB | Output is correct |
4 | Correct | 72 ms | 79312 KB | Output is correct |
5 | Correct | 119 ms | 79628 KB | Output is correct |
6 | Correct | 60 ms | 79444 KB | Output is correct |
7 | Correct | 55 ms | 79352 KB | Output is correct |
8 | Correct | 71 ms | 79440 KB | Output is correct |
9 | Correct | 136 ms | 79688 KB | Output is correct |
10 | Correct | 180 ms | 79684 KB | Output is correct |
11 | Correct | 157 ms | 79440 KB | Output is correct |
12 | Correct | 88 ms | 79696 KB | Output is correct |
13 | Correct | 57 ms | 79552 KB | Output is correct |
14 | Correct | 73 ms | 79444 KB | Output is correct |
15 | Correct | 136 ms | 79440 KB | Output is correct |
16 | Correct | 64 ms | 79772 KB | Output is correct |
17 | Correct | 142 ms | 79476 KB | Output is correct |
18 | Correct | 150 ms | 79956 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 139 ms | 79700 KB | Output is correct |
2 | Correct | 175 ms | 79620 KB | Output is correct |
3 | Correct | 170 ms | 79864 KB | Output is correct |
4 | Correct | 111 ms | 79544 KB | Output is correct |
5 | Correct | 81 ms | 79956 KB | Output is correct |
6 | Correct | 146 ms | 79692 KB | Output is correct |
7 | Correct | 130 ms | 79804 KB | Output is correct |
8 | Correct | 133 ms | 79940 KB | Output is correct |
9 | Correct | 141 ms | 79624 KB | Output is correct |
10 | Correct | 116 ms | 79440 KB | Output is correct |
11 | Correct | 101 ms | 79416 KB | Output is correct |
12 | Correct | 128 ms | 79440 KB | Output is correct |
13 | Correct | 170 ms | 79788 KB | Output is correct |
14 | Correct | 98 ms | 79924 KB | Output is correct |
15 | Correct | 137 ms | 79440 KB | Output is correct |
16 | Correct | 152 ms | 79424 KB | Output is correct |
17 | Correct | 139 ms | 79592 KB | Output is correct |
18 | Correct | 173 ms | 79696 KB | Output is correct |
19 | Correct | 58 ms | 79324 KB | Output is correct |
20 | Correct | 169 ms | 79864 KB | Output is correct |
21 | Correct | 107 ms | 79956 KB | Output is correct |
22 | Correct | 204 ms | 80064 KB | Output is correct |
23 | Correct | 83 ms | 79700 KB | Output is correct |
24 | Correct | 76 ms | 79580 KB | Output is correct |
25 | Correct | 120 ms | 79716 KB | Output is correct |
26 | Correct | 108 ms | 79696 KB | Output is correct |
27 | Correct | 194 ms | 79952 KB | Output is correct |
28 | Correct | 71 ms | 79704 KB | Output is correct |
29 | Correct | 163 ms | 79956 KB | Output is correct |
30 | Correct | 164 ms | 79948 KB | Output is correct |
31 | Correct | 83 ms | 79688 KB | Output is correct |
32 | Correct | 91 ms | 79684 KB | Output is correct |
33 | Correct | 65 ms | 79680 KB | Output is correct |
34 | Correct | 123 ms | 80064 KB | Output is correct |
35 | Correct | 71 ms | 79596 KB | Output is correct |
36 | Correct | 173 ms | 80032 KB | Output is correct |
37 | Correct | 81 ms | 80056 KB | Output is correct |
38 | Correct | 136 ms | 79688 KB | Output is correct |
39 | Correct | 78 ms | 79696 KB | Output is correct |
40 | Correct | 127 ms | 79688 KB | Output is correct |
41 | Correct | 114 ms | 79804 KB | Output is correct |
42 | Correct | 156 ms | 79668 KB | Output is correct |