답안 #60813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
60813 2018-07-24T17:25:09 Z RezwanArefin01 Brunhilda’s Birthday (BOI13_brunhilda) C++17
93.1746 / 100
605 ms 89284 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii; 

const int N = 1e7 + 1; 
const int M = 1e5 + 1; 
int m, q, d[N], p, dp[N]; 

int main(int argc, char const *argv[]) {
	scanf("%d %d", &m, &q); 
	ll prod = 1; bool flag = 0; 
	for(int i = 0; i < m; i++) { 
		scanf("%d", &p); 
		if(prod * p <= 1e7) prod *= p;
		else flag = 1; 
		for(int j = 0; j < N; j += p) d[j] = p; 
	}	
	int prv = 0;
	for(int i = 1; i < N; i++) {
		while(prv < i) {
			if(!d[prv] || prv + d[prv] <= i) ++prv; 
			else break; 
		}
		if(prv == i) break; 
		dp[i] = dp[prv] + 1; 
	}
	while(q--) {
		int x; scanf("%d", &x);
		if(x >= (flag ? 1e7 : prod)) 
			puts("oo"); 
		else {
			printf("%d\n", dp[x]);
		} 
	}
}

Compilation message

brunhilda.cpp: In function 'int main(int, const char**)':
brunhilda.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &m, &q); 
  ~~~~~^~~~~~~~~~~~~~~~~
brunhilda.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &p); 
   ~~~~~^~~~~~~~~~
brunhilda.cpp:30:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x; scanf("%d", &x);
          ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 44 ms 39544 KB Output is correct
2 Correct 177 ms 78704 KB Output is correct
3 Correct 65 ms 78704 KB Output is correct
4 Correct 131 ms 78792 KB Output is correct
5 Correct 207 ms 79024 KB Output is correct
6 Correct 44 ms 79024 KB Output is correct
7 Correct 62 ms 79024 KB Output is correct
8 Correct 74 ms 79024 KB Output is correct
9 Correct 225 ms 79024 KB Output is correct
10 Correct 221 ms 79024 KB Output is correct
11 Correct 239 ms 79024 KB Output is correct
12 Correct 122 ms 79024 KB Output is correct
13 Correct 399 ms 79024 KB Output is correct
14 Correct 392 ms 79068 KB Output is correct
15 Correct 230 ms 79068 KB Output is correct
16 Correct 187 ms 79096 KB Output is correct
17 Correct 199 ms 79100 KB Output is correct
18 Correct 149 ms 79160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 153 ms 79216 KB Output is correct
2 Correct 214 ms 79936 KB Output is correct
3 Correct 445 ms 80428 KB Output is correct
4 Correct 226 ms 80516 KB Output is correct
5 Correct 357 ms 80772 KB Output is correct
6 Correct 168 ms 80784 KB Output is correct
7 Correct 174 ms 80920 KB Output is correct
8 Correct 239 ms 80920 KB Output is correct
9 Correct 431 ms 81396 KB Output is correct
10 Correct 522 ms 81892 KB Output is correct
11 Correct 524 ms 81892 KB Output is correct
12 Correct 264 ms 81892 KB Output is correct
13 Correct 159 ms 81892 KB Output is correct
14 Correct 237 ms 81892 KB Output is correct
15 Correct 356 ms 81908 KB Output is correct
16 Correct 167 ms 81908 KB Output is correct
17 Correct 389 ms 81908 KB Output is correct
18 Incorrect 369 ms 81908 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 361 ms 81992 KB Output is correct
2 Correct 455 ms 82008 KB Output is correct
3 Correct 483 ms 82484 KB Output is correct
4 Correct 339 ms 82584 KB Output is correct
5 Correct 296 ms 83156 KB Output is correct
6 Correct 436 ms 83256 KB Output is correct
7 Correct 426 ms 83256 KB Output is correct
8 Correct 427 ms 83536 KB Output is correct
9 Correct 457 ms 83656 KB Output is correct
10 Correct 372 ms 83656 KB Output is correct
11 Correct 344 ms 83656 KB Output is correct
12 Correct 393 ms 83656 KB Output is correct
13 Correct 489 ms 84332 KB Output is correct
14 Correct 294 ms 84584 KB Output is correct
15 Correct 405 ms 84584 KB Output is correct
16 Correct 496 ms 84584 KB Output is correct
17 Correct 452 ms 84584 KB Output is correct
18 Correct 483 ms 84584 KB Output is correct
19 Correct 166 ms 84584 KB Output is correct
20 Correct 558 ms 84584 KB Output is correct
21 Incorrect 339 ms 84832 KB Output isn't correct
22 Correct 467 ms 85088 KB Output is correct
23 Correct 227 ms 85696 KB Output is correct
24 Correct 187 ms 85928 KB Output is correct
25 Correct 382 ms 86000 KB Output is correct
26 Correct 330 ms 86000 KB Output is correct
27 Correct 533 ms 86000 KB Output is correct
28 Incorrect 227 ms 86044 KB Output isn't correct
29 Correct 545 ms 86644 KB Output is correct
30 Correct 439 ms 87292 KB Output is correct
31 Correct 261 ms 87336 KB Output is correct
32 Correct 295 ms 87336 KB Output is correct
33 Correct 194 ms 87420 KB Output is correct
34 Correct 472 ms 87420 KB Output is correct
35 Incorrect 201 ms 87560 KB Output isn't correct
36 Correct 605 ms 88204 KB Output is correct
37 Correct 255 ms 88728 KB Output is correct
38 Correct 416 ms 88736 KB Output is correct
39 Correct 214 ms 88744 KB Output is correct
40 Correct 339 ms 88744 KB Output is correct
41 Correct 345 ms 88864 KB Output is correct
42 Incorrect 463 ms 89284 KB Output isn't correct