답안 #378495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
378495 2021-03-17T00:53:14 Z YJU Brunhilda’s Birthday (BOI13_brunhilda) C++14
97.7778 / 100
448 ms 189036 KB
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector,Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll N=12e6+5;
const ll INF=1e9+1;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define lwb lower_bound

ll m,q,x,jump[N],dp[N];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>m>>q;
	REP(i,m){
		cin>>x;
		for(int j=x-1;j<N;j+=x){
			jump[j]=x-1;
		}
	}
	for(int i=N-2;i>=1;i--){
		jump[i]=max(jump[i],jump[i+1]-1);
	}
	for(int i=1;i<N;i++){
		if(jump[i]==0)dp[i]=INF;
		else dp[i]=min(dp[i-jump[i]]+1,INF);
	}
	while(q--){
		cin>>x;
		if(dp[x]>x){
			cout<<"OO\n";
		}else{
			cout<<dp[x]<<"\n";
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 146 ms 188140 KB Output isn't correct
2 Correct 176 ms 188228 KB Output is correct
3 Correct 159 ms 188268 KB Output is correct
4 Correct 142 ms 188396 KB Output is correct
5 Correct 155 ms 188268 KB Output is correct
6 Incorrect 144 ms 188140 KB Output isn't correct
7 Correct 159 ms 188140 KB Output is correct
8 Correct 172 ms 188268 KB Output is correct
9 Correct 194 ms 188204 KB Output is correct
10 Correct 220 ms 188172 KB Output is correct
11 Correct 203 ms 188268 KB Output is correct
12 Correct 139 ms 188140 KB Output is correct
13 Correct 325 ms 188268 KB Output is correct
14 Correct 329 ms 188268 KB Output is correct
15 Correct 180 ms 188268 KB Output is correct
16 Correct 170 ms 188140 KB Output is correct
17 Correct 167 ms 188268 KB Output is correct
18 Correct 140 ms 188396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 174 ms 188268 KB Output is correct
2 Correct 181 ms 188268 KB Output is correct
3 Correct 396 ms 188268 KB Output is correct
4 Correct 185 ms 188248 KB Output is correct
5 Correct 286 ms 188396 KB Output is correct
6 Correct 166 ms 188140 KB Output is correct
7 Correct 160 ms 188140 KB Output is correct
8 Correct 183 ms 188396 KB Output is correct
9 Correct 320 ms 188224 KB Output is correct
10 Correct 398 ms 188396 KB Output is correct
11 Correct 379 ms 188140 KB Output is correct
12 Correct 231 ms 188140 KB Output is correct
13 Correct 150 ms 188140 KB Output is correct
14 Correct 183 ms 188268 KB Output is correct
15 Correct 329 ms 188268 KB Output is correct
16 Correct 177 ms 188160 KB Output is correct
17 Correct 332 ms 188268 KB Output is correct
18 Correct 333 ms 188140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 345 ms 188268 KB Output is correct
2 Correct 400 ms 188396 KB Output is correct
3 Correct 410 ms 188396 KB Output is correct
4 Correct 266 ms 188396 KB Output is correct
5 Correct 219 ms 188524 KB Output is correct
6 Correct 341 ms 188524 KB Output is correct
7 Correct 293 ms 188268 KB Output is correct
8 Correct 343 ms 188396 KB Output is correct
9 Correct 348 ms 188396 KB Output is correct
10 Correct 270 ms 188268 KB Output is correct
11 Correct 234 ms 188268 KB Output is correct
12 Correct 316 ms 188268 KB Output is correct
13 Correct 406 ms 188524 KB Output is correct
14 Correct 247 ms 188800 KB Output is correct
15 Correct 333 ms 188268 KB Output is correct
16 Correct 361 ms 188268 KB Output is correct
17 Correct 314 ms 188268 KB Output is correct
18 Correct 405 ms 188268 KB Output is correct
19 Correct 164 ms 188268 KB Output is correct
20 Correct 414 ms 188524 KB Output is correct
21 Correct 284 ms 188908 KB Output is correct
22 Correct 417 ms 188524 KB Output is correct
23 Correct 219 ms 188524 KB Output is correct
24 Correct 185 ms 188524 KB Output is correct
25 Correct 287 ms 188652 KB Output is correct
26 Correct 268 ms 188544 KB Output is correct
27 Correct 447 ms 188396 KB Output is correct
28 Correct 178 ms 188524 KB Output is correct
29 Correct 387 ms 188524 KB Output is correct
30 Correct 360 ms 188524 KB Output is correct
31 Correct 206 ms 188780 KB Output is correct
32 Correct 229 ms 188800 KB Output is correct
33 Correct 182 ms 188688 KB Output is correct
34 Correct 311 ms 188524 KB Output is correct
35 Correct 197 ms 188824 KB Output is correct
36 Correct 448 ms 188652 KB Output is correct
37 Correct 234 ms 188756 KB Output is correct
38 Correct 373 ms 188908 KB Output is correct
39 Correct 215 ms 189036 KB Output is correct
40 Correct 326 ms 188852 KB Output is correct
41 Correct 290 ms 188652 KB Output is correct
42 Correct 401 ms 189036 KB Output is correct