답안 #283154

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283154 2020-08-25T10:40:29 Z theStaticMind Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
585 ms 48220 KB
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
//#define int long long int
using namespace std;

int dp[10000001];

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	freopen("q.gir", "r", stdin);
	freopen("q.cik", "w", stdout);

	int m, q;
	cin >> m >> q;

	vector<int> P(m);
	for(int i = 0; i < m; i++) cin >> P[i];

	for(int i = 1; i <= 1e7; i++){
		dp[i] = 1e9;
		for(int j = m - 1; j >= 0 && j >= m - 12; j--){
			dp[i] = min(dp[i], dp[i - i % P[j]] + 1);

		}
	}

	while(q--){
		int n;
		cin >> n;

		if(dp[n] >= 1e9) cout << "oo\n";
		else cout << dp[n] << "\n";
	}
}

Compilation message

brunhilda.cpp: In function 'int32_t main()':
brunhilda.cpp:18:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   18 |  freopen("q.gir", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
brunhilda.cpp:19:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   19 |  freopen("q.cik", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 394 ms 47992 KB Output isn't correct
2 Incorrect 397 ms 48124 KB Output isn't correct
3 Incorrect 395 ms 47992 KB Output isn't correct
4 Incorrect 387 ms 48120 KB Output isn't correct
5 Incorrect 389 ms 47992 KB Output isn't correct
6 Incorrect 397 ms 47992 KB Output isn't correct
7 Incorrect 391 ms 47992 KB Output isn't correct
8 Incorrect 392 ms 48036 KB Output isn't correct
9 Incorrect 398 ms 48124 KB Output isn't correct
10 Incorrect 395 ms 47996 KB Output isn't correct
11 Incorrect 450 ms 47992 KB Output isn't correct
12 Incorrect 395 ms 48120 KB Output isn't correct
13 Incorrect 389 ms 47920 KB Output isn't correct
14 Incorrect 407 ms 48184 KB Output isn't correct
15 Incorrect 391 ms 47992 KB Output isn't correct
16 Incorrect 402 ms 48016 KB Output isn't correct
17 Incorrect 400 ms 48060 KB Output isn't correct
18 Incorrect 391 ms 47916 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 401 ms 48220 KB Output isn't correct
2 Incorrect 385 ms 48020 KB Output isn't correct
3 Incorrect 390 ms 48084 KB Output isn't correct
4 Incorrect 416 ms 48120 KB Output isn't correct
5 Incorrect 399 ms 47992 KB Output isn't correct
6 Incorrect 390 ms 48120 KB Output isn't correct
7 Incorrect 390 ms 47992 KB Output isn't correct
8 Incorrect 394 ms 48120 KB Output isn't correct
9 Incorrect 403 ms 47992 KB Output isn't correct
10 Incorrect 391 ms 48152 KB Output isn't correct
11 Incorrect 389 ms 47992 KB Output isn't correct
12 Incorrect 390 ms 47992 KB Output isn't correct
13 Incorrect 387 ms 47992 KB Output isn't correct
14 Incorrect 395 ms 47992 KB Output isn't correct
15 Incorrect 402 ms 48020 KB Output isn't correct
16 Incorrect 393 ms 48144 KB Output isn't correct
17 Incorrect 392 ms 47992 KB Output isn't correct
18 Incorrect 409 ms 47996 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 390 ms 47992 KB Output isn't correct
2 Incorrect 396 ms 48052 KB Output isn't correct
3 Incorrect 397 ms 47992 KB Output isn't correct
4 Incorrect 398 ms 47944 KB Output isn't correct
5 Incorrect 389 ms 47992 KB Output isn't correct
6 Incorrect 389 ms 47992 KB Output isn't correct
7 Incorrect 386 ms 47992 KB Output isn't correct
8 Incorrect 393 ms 47968 KB Output isn't correct
9 Incorrect 394 ms 48000 KB Output isn't correct
10 Incorrect 384 ms 47992 KB Output isn't correct
11 Incorrect 397 ms 47916 KB Output isn't correct
12 Incorrect 406 ms 47984 KB Output isn't correct
13 Incorrect 393 ms 48120 KB Output isn't correct
14 Incorrect 400 ms 47944 KB Output isn't correct
15 Incorrect 406 ms 48120 KB Output isn't correct
16 Incorrect 394 ms 47916 KB Output isn't correct
17 Incorrect 402 ms 47908 KB Output isn't correct
18 Incorrect 437 ms 48120 KB Output isn't correct
19 Incorrect 409 ms 48020 KB Output isn't correct
20 Incorrect 398 ms 47920 KB Output isn't correct
21 Incorrect 398 ms 47992 KB Output isn't correct
22 Incorrect 391 ms 47992 KB Output isn't correct
23 Incorrect 394 ms 47968 KB Output isn't correct
24 Incorrect 460 ms 47992 KB Output isn't correct
25 Incorrect 454 ms 47924 KB Output isn't correct
26 Incorrect 410 ms 47992 KB Output isn't correct
27 Incorrect 418 ms 47992 KB Output isn't correct
28 Incorrect 450 ms 47992 KB Output isn't correct
29 Incorrect 395 ms 47992 KB Output isn't correct
30 Incorrect 400 ms 47992 KB Output isn't correct
31 Incorrect 578 ms 47992 KB Output isn't correct
32 Incorrect 585 ms 48016 KB Output isn't correct
33 Incorrect 418 ms 47992 KB Output isn't correct
34 Incorrect 524 ms 48124 KB Output isn't correct
35 Incorrect 401 ms 47992 KB Output isn't correct
36 Incorrect 402 ms 48016 KB Output isn't correct
37 Incorrect 387 ms 47992 KB Output isn't correct
38 Incorrect 390 ms 47992 KB Output isn't correct
39 Incorrect 420 ms 47984 KB Output isn't correct
40 Incorrect 388 ms 48120 KB Output isn't correct
41 Incorrect 409 ms 48088 KB Output isn't correct
42 Incorrect 412 ms 47992 KB Output isn't correct