Submission #134017

# Submission time Handle Problem Language Result Execution time Memory
134017 2019-07-21T23:16:40 Z CaroLinda Brunhilda’s Birthday (BOI13_brunhilda) C++14
54.9206 / 100
1000 ms 40952 KB
#include <bits/stdc++.h>

#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:31: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:32: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:36:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &x ) ;
   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 39416 KB Output isn't correct
2 Correct 35 ms 39416 KB Output is correct
3 Correct 34 ms 39544 KB Output is correct
4 Correct 40 ms 39544 KB Output is correct
5 Correct 34 ms 39416 KB Output is correct
6 Incorrect 35 ms 39544 KB Output isn't correct
7 Correct 34 ms 39416 KB Output is correct
8 Correct 36 ms 39416 KB Output is correct
9 Correct 34 ms 39416 KB Output is correct
10 Correct 35 ms 39416 KB Output is correct
11 Correct 35 ms 39488 KB Output is correct
12 Correct 35 ms 39460 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 39420 KB Output is correct
16 Correct 35 ms 39416 KB Output is correct
17 Correct 39 ms 39416 KB Output is correct
18 Correct 39 ms 39544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 39544 KB Output is correct
2 Correct 48 ms 39748 KB Output is correct
3 Correct 51 ms 39772 KB Output is correct
4 Correct 36 ms 39544 KB Output is correct
5 Correct 41 ms 39672 KB Output is correct
6 Correct 35 ms 39416 KB Output is correct
7 Correct 36 ms 39544 KB Output is correct
8 Correct 35 ms 39388 KB Output is correct
9 Correct 45 ms 39752 KB Output is correct
10 Correct 45 ms 39752 KB Output is correct
11 Correct 42 ms 39672 KB Output is correct
12 Correct 37 ms 39416 KB Output is correct
13 Correct 34 ms 39516 KB Output is correct
14 Correct 36 ms 39516 KB Output is correct
15 Correct 40 ms 39672 KB Output is correct
16 Correct 48 ms 39800 KB Output is correct
17 Correct 38 ms 39544 KB Output is correct
18 Correct 49 ms 39800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 39592 KB Time limit exceeded
2 Execution timed out 1075 ms 39672 KB Time limit exceeded
3 Execution timed out 1086 ms 39936 KB Time limit exceeded
4 Execution timed out 1082 ms 39928 KB Time limit exceeded
5 Execution timed out 1080 ms 39800 KB Time limit exceeded
6 Execution timed out 1083 ms 39788 KB Time limit exceeded
7 Execution timed out 1087 ms 39964 KB Time limit exceeded
8 Execution timed out 1062 ms 39672 KB Time limit exceeded
9 Execution timed out 1096 ms 39672 KB Time limit exceeded
10 Correct 646 ms 39544 KB Output is correct
11 Correct 632 ms 39544 KB Output is correct
12 Correct 890 ms 39800 KB Output is correct
13 Execution timed out 1086 ms 39680 KB Time limit exceeded
14 Correct 81 ms 40952 KB Output is correct
15 Correct 951 ms 39560 KB Output is correct
16 Execution timed out 1092 ms 39672 KB Time limit exceeded
17 Execution timed out 1085 ms 39676 KB Time limit exceeded
18 Execution timed out 1070 ms 39672 KB Time limit exceeded
19 Correct 613 ms 39672 KB Output is correct
20 Execution timed out 1089 ms 39800 KB Time limit exceeded
21 Correct 128 ms 40312 KB Output is correct
22 Execution timed out 1074 ms 39928 KB Time limit exceeded
23 Execution timed out 1085 ms 39544 KB Time limit exceeded
24 Correct 479 ms 39824 KB Output is correct
25 Execution timed out 1082 ms 39928 KB Time limit exceeded
26 Execution timed out 1080 ms 39928 KB Time limit exceeded
27 Execution timed out 1095 ms 39900 KB Time limit exceeded
28 Correct 422 ms 39936 KB Output is correct
29 Execution timed out 1083 ms 39928 KB Time limit exceeded
30 Execution timed out 1075 ms 39800 KB Time limit exceeded
31 Execution timed out 1092 ms 39648 KB Time limit exceeded
32 Execution timed out 1085 ms 39776 KB Time limit exceeded
33 Correct 482 ms 39804 KB Output is correct
34 Execution timed out 1081 ms 39900 KB Time limit exceeded
35 Correct 775 ms 39928 KB Output is correct
36 Execution timed out 1089 ms 39800 KB Time limit exceeded
37 Execution timed out 1081 ms 39800 KB Time limit exceeded
38 Execution timed out 1078 ms 39772 KB Time limit exceeded
39 Correct 963 ms 39928 KB Output is correct
40 Execution timed out 1089 ms 39800 KB Time limit exceeded
41 Execution timed out 1068 ms 39928 KB Time limit exceeded
42 Execution timed out 1081 ms 40036 KB Time limit exceeded