답안 #134014

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
134014 2019-07-21T23:10:06 Z CaroLinda Brunhilda’s Birthday (BOI13_brunhilda) C++14
54.9206 / 100
1000 ms 41592 KB
#include <bits/stdc++.h>

#include <bits/stdc++.h>

#define MAXN 4002
#define lp(i,a,b) for(int i=a;i<b;i++)
#define pii pair<int,int>
#define ff first
#define ss second
#define pb push_back

const int MAXM = 1e5+10 ;
const int MAX = 1e7+10 ;

using namespace std ;

int v[MAXM] , dp[MAX] ;
int m , q ;

int solve(int x)
{
	if(x == 0) return 0 ;
	if(dp[x] != -1) return dp[x] ;
	int maior = 0 ;
	lp(i,0,m) maior = max(maior, x%v[i] ) ;
	if(maior==0) return -1 ;
	return dp[x] = solve(x-maior) + 1 ;
}

int main()
{
	memset(dp,-1,sizeof dp) ;

	scanf("%d%d", &m, &q) ;
	lp(i,0,m) scanf("%d", &v[i]) ;
	lp(i,0,q)
	{
		int x ;
		scanf("%d", &x ) ;
		int ans = solve(x) ;
		if(ans==-1) printf("oo\n") ;
		else printf("%d\n", ans ) ;
	}
}

Compilation message

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:34: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:35:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  lp(i,0,m) scanf("%d", &v[i]) ;
            ~~~~~^~~~~~~~~~~~~
brunhilda.cpp:39:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &x ) ;
   ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 39416 KB Output isn't correct
2 Correct 34 ms 39416 KB Output is correct
3 Correct 34 ms 39416 KB Output is correct
4 Correct 39 ms 39416 KB Output is correct
5 Correct 35 ms 39416 KB Output is correct
6 Incorrect 35 ms 39416 KB Output isn't correct
7 Correct 34 ms 39504 KB Output is correct
8 Correct 34 ms 39536 KB Output is correct
9 Correct 34 ms 39416 KB Output is correct
10 Correct 35 ms 39416 KB Output is correct
11 Correct 34 ms 39516 KB Output is correct
12 Correct 34 ms 39416 KB Output is correct
13 Correct 38 ms 39416 KB Output is correct
14 Correct 69 ms 39544 KB Output is correct
15 Correct 35 ms 39416 KB Output is correct
16 Correct 35 ms 39416 KB Output is correct
17 Correct 39 ms 39416 KB Output is correct
18 Correct 40 ms 39416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 39544 KB Output is correct
2 Correct 48 ms 39888 KB Output is correct
3 Correct 44 ms 39800 KB Output is correct
4 Correct 36 ms 39548 KB Output is correct
5 Correct 41 ms 39676 KB Output is correct
6 Correct 35 ms 39416 KB Output is correct
7 Correct 36 ms 39544 KB Output is correct
8 Correct 41 ms 39388 KB Output is correct
9 Correct 44 ms 39804 KB Output is correct
10 Correct 44 ms 39764 KB Output is correct
11 Correct 42 ms 39672 KB Output is correct
12 Correct 36 ms 39544 KB Output is correct
13 Correct 35 ms 39544 KB Output is correct
14 Correct 36 ms 39672 KB Output is correct
15 Correct 40 ms 39644 KB Output is correct
16 Correct 47 ms 39800 KB Output is correct
17 Correct 37 ms 39544 KB Output is correct
18 Correct 49 ms 39928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1074 ms 39672 KB Time limit exceeded
2 Execution timed out 1070 ms 39676 KB Time limit exceeded
3 Execution timed out 1065 ms 39840 KB Time limit exceeded
4 Execution timed out 1087 ms 40312 KB Time limit exceeded
5 Execution timed out 1084 ms 39928 KB Time limit exceeded
6 Execution timed out 1057 ms 39784 KB Time limit exceeded
7 Execution timed out 1091 ms 40056 KB Time limit exceeded
8 Execution timed out 1081 ms 39672 KB Time limit exceeded
9 Execution timed out 1082 ms 39672 KB Time limit exceeded
10 Correct 647 ms 39544 KB Output is correct
11 Correct 631 ms 39544 KB Output is correct
12 Correct 899 ms 39800 KB Output is correct
13 Execution timed out 1080 ms 39888 KB Time limit exceeded
14 Correct 81 ms 41592 KB Output is correct
15 Correct 947 ms 39872 KB Output is correct
16 Execution timed out 1087 ms 39800 KB Time limit exceeded
17 Execution timed out 1076 ms 39672 KB Time limit exceeded
18 Execution timed out 1075 ms 39672 KB Time limit exceeded
19 Correct 611 ms 39800 KB Output is correct
20 Execution timed out 1079 ms 39928 KB Time limit exceeded
21 Correct 111 ms 41020 KB Output is correct
22 Execution timed out 1076 ms 39912 KB Time limit exceeded
23 Execution timed out 1082 ms 39544 KB Time limit exceeded
24 Correct 474 ms 40440 KB Output is correct
25 Execution timed out 1077 ms 40440 KB Time limit exceeded
26 Execution timed out 1085 ms 40440 KB Time limit exceeded
27 Execution timed out 1068 ms 39928 KB Time limit exceeded
28 Correct 417 ms 40568 KB Output is correct
29 Execution timed out 1076 ms 39900 KB Time limit exceeded
30 Execution timed out 1089 ms 39800 KB Time limit exceeded
31 Execution timed out 1086 ms 40168 KB Time limit exceeded
32 Execution timed out 1075 ms 40532 KB Time limit exceeded
33 Correct 482 ms 40312 KB Output is correct
34 Execution timed out 1071 ms 39896 KB Time limit exceeded
35 Correct 770 ms 40568 KB Output is correct
36 Execution timed out 1083 ms 39800 KB Time limit exceeded
37 Execution timed out 1087 ms 39800 KB Time limit exceeded
38 Execution timed out 1077 ms 39920 KB Time limit exceeded
39 Correct 962 ms 40444 KB Output is correct
40 Execution timed out 1079 ms 39932 KB Time limit exceeded
41 Execution timed out 1067 ms 39928 KB Time limit exceeded
42 Execution timed out 1089 ms 40684 KB Time limit exceeded