# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
944485 | 2024-03-12T18:57:08 Z | vjudge1 | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 221 ms | 80724 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+10,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(i<v.back())ans[i]=1; 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 | 64 ms | 78680 KB | Output is correct |
2 | Correct | 67 ms | 78672 KB | Output is correct |
3 | Correct | 79 ms | 78492 KB | Output is correct |
4 | Correct | 61 ms | 78780 KB | Output is correct |
5 | Correct | 58 ms | 78488 KB | Output is correct |
6 | Correct | 63 ms | 78676 KB | Output is correct |
7 | Correct | 66 ms | 78496 KB | Output is correct |
8 | Correct | 69 ms | 78496 KB | Output is correct |
9 | Correct | 73 ms | 78672 KB | Output is correct |
10 | Correct | 84 ms | 78672 KB | Output is correct |
11 | Correct | 79 ms | 78496 KB | Output is correct |
12 | Correct | 59 ms | 78740 KB | Output is correct |
13 | Correct | 146 ms | 78676 KB | Output is correct |
14 | Correct | 140 ms | 78676 KB | Output is correct |
15 | Correct | 70 ms | 78672 KB | Output is correct |
16 | Correct | 75 ms | 78712 KB | Output is correct |
17 | Correct | 64 ms | 78676 KB | Output is correct |
18 | Correct | 51 ms | 78572 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 65 ms | 78656 KB | Output is correct |
2 | Correct | 86 ms | 79696 KB | Output is correct |
3 | Correct | 182 ms | 79252 KB | Output is correct |
4 | Correct | 76 ms | 78628 KB | Output is correct |
5 | Correct | 119 ms | 79188 KB | Output is correct |
6 | Correct | 68 ms | 78500 KB | Output is correct |
7 | Correct | 66 ms | 78932 KB | Output is correct |
8 | Correct | 73 ms | 78500 KB | Output is correct |
9 | Correct | 148 ms | 79364 KB | Output is correct |
10 | Correct | 176 ms | 79444 KB | Output is correct |
11 | Incorrect | 216 ms | 78992 KB | Output isn't correct |
12 | Correct | 109 ms | 78548 KB | Output is correct |
13 | Correct | 54 ms | 78520 KB | Output is correct |
14 | Correct | 75 ms | 78676 KB | Output is correct |
15 | Correct | 141 ms | 78928 KB | Output is correct |
16 | Correct | 69 ms | 79752 KB | Output is correct |
17 | Correct | 147 ms | 78524 KB | Output is correct |
18 | Correct | 143 ms | 79620 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 155 ms | 79440 KB | Output is correct |
2 | Correct | 184 ms | 79464 KB | Output is correct |
3 | Correct | 186 ms | 79748 KB | Output is correct |
4 | Incorrect | 120 ms | 79500 KB | Output isn't correct |
5 | Incorrect | 89 ms | 80724 KB | Output isn't correct |
6 | Correct | 176 ms | 79780 KB | Output is correct |
7 | Correct | 131 ms | 80208 KB | Output is correct |
8 | Correct | 158 ms | 79440 KB | Output is correct |
9 | Correct | 153 ms | 79452 KB | Output is correct |
10 | Correct | 148 ms | 78912 KB | Output is correct |
11 | Incorrect | 99 ms | 78976 KB | Output isn't correct |
12 | Correct | 140 ms | 78988 KB | Output is correct |
13 | Correct | 181 ms | 80000 KB | Output is correct |
14 | Correct | 105 ms | 79784 KB | Output is correct |
15 | Incorrect | 144 ms | 78856 KB | Output isn't correct |
16 | Correct | 164 ms | 78884 KB | Output is correct |
17 | Correct | 137 ms | 79072 KB | Output is correct |
18 | Correct | 188 ms | 79444 KB | Output is correct |
19 | Incorrect | 62 ms | 78928 KB | Output isn't correct |
20 | Correct | 190 ms | 79696 KB | Output is correct |
21 | Incorrect | 125 ms | 80040 KB | Output isn't correct |
22 | Correct | 188 ms | 80556 KB | Output is correct |
23 | Correct | 92 ms | 79956 KB | Output is correct |
24 | Correct | 75 ms | 79696 KB | Output is correct |
25 | Correct | 139 ms | 79656 KB | Output is correct |
26 | Incorrect | 125 ms | 79440 KB | Output isn't correct |
27 | Correct | 215 ms | 80284 KB | Output is correct |
28 | Incorrect | 75 ms | 79952 KB | Output isn't correct |
29 | Correct | 221 ms | 80724 KB | Output is correct |
30 | Correct | 164 ms | 80440 KB | Output is correct |
31 | Correct | 84 ms | 79428 KB | Output is correct |
32 | Incorrect | 95 ms | 79696 KB | Output isn't correct |
33 | Incorrect | 67 ms | 79532 KB | Output isn't correct |
34 | Correct | 134 ms | 80372 KB | Output is correct |
35 | Incorrect | 76 ms | 79812 KB | Output isn't correct |
36 | Correct | 188 ms | 80448 KB | Output is correct |
37 | Incorrect | 88 ms | 80720 KB | Output isn't correct |
38 | Correct | 145 ms | 79700 KB | Output is correct |
39 | Incorrect | 82 ms | 79612 KB | Output isn't correct |
40 | Correct | 135 ms | 79700 KB | Output is correct |
41 | Correct | 115 ms | 80296 KB | Output is correct |
42 | Correct | 159 ms | 79700 KB | Output is correct |