Submission #134012

# Submission time Handle Problem Language Result Execution time Memory
134012 2019-07-21T23:07:04 Z CaroLinda Brunhilda’s Birthday (BOI13_brunhilda) C++14
37.7778 / 100
1000 ms 1756 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 ;

using namespace std ;

int v[MAXM] ;
int m , q ;

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

int main()
{
	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 6 ms 256 KB Output isn't correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 9 ms 380 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Incorrect 6 ms 376 KB Output isn't correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 8 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 36 ms 376 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 24 ms 376 KB Output is correct
18 Correct 9 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 16 ms 1372 KB Output is correct
3 Correct 12 ms 1016 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 9 ms 860 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 13 ms 1144 KB Output is correct
10 Correct 12 ms 1016 KB Output is correct
11 Correct 10 ms 764 KB Output is correct
12 Correct 4 ms 380 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 3 ms 388 KB Output is correct
15 Correct 8 ms 760 KB Output is correct
16 Correct 16 ms 1400 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 17 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1010 ms 1016 KB Time limit exceeded
2 Execution timed out 1040 ms 1040 KB Time limit exceeded
3 Execution timed out 1040 ms 1016 KB Time limit exceeded
4 Execution timed out 1043 ms 488 KB Time limit exceeded
5 Execution timed out 1045 ms 1528 KB Time limit exceeded
6 Execution timed out 1070 ms 632 KB Time limit exceeded
7 Execution timed out 1068 ms 1572 KB Time limit exceeded
8 Execution timed out 1082 ms 1016 KB Time limit exceeded
9 Execution timed out 1063 ms 1020 KB Time limit exceeded
10 Execution timed out 1064 ms 376 KB Time limit exceeded
11 Execution timed out 1082 ms 376 KB Time limit exceeded
12 Execution timed out 1088 ms 376 KB Time limit exceeded
13 Execution timed out 1079 ms 760 KB Time limit exceeded
14 Execution timed out 1080 ms 1144 KB Time limit exceeded
15 Execution timed out 1084 ms 376 KB Time limit exceeded
16 Execution timed out 1083 ms 504 KB Time limit exceeded
17 Execution timed out 1075 ms 888 KB Time limit exceeded
18 Execution timed out 1083 ms 1016 KB Time limit exceeded
19 Execution timed out 1078 ms 632 KB Time limit exceeded
20 Execution timed out 1084 ms 1016 KB Time limit exceeded
21 Execution timed out 1087 ms 508 KB Time limit exceeded
22 Execution timed out 1082 ms 1564 KB Time limit exceeded
23 Execution timed out 1074 ms 760 KB Time limit exceeded
24 Execution timed out 1067 ms 508 KB Time limit exceeded
25 Execution timed out 1077 ms 504 KB Time limit exceeded
26 Execution timed out 1078 ms 608 KB Time limit exceeded
27 Execution timed out 1082 ms 1656 KB Time limit exceeded
28 Execution timed out 1077 ms 504 KB Time limit exceeded
29 Execution timed out 1080 ms 1532 KB Time limit exceeded
30 Execution timed out 1077 ms 1272 KB Time limit exceeded
31 Execution timed out 1083 ms 628 KB Time limit exceeded
32 Execution timed out 1083 ms 484 KB Time limit exceeded
33 Execution timed out 1079 ms 760 KB Time limit exceeded
34 Execution timed out 1076 ms 1656 KB Time limit exceeded
35 Execution timed out 1072 ms 556 KB Time limit exceeded
36 Execution timed out 1080 ms 1656 KB Time limit exceeded
37 Execution timed out 1081 ms 1656 KB Time limit exceeded
38 Execution timed out 1087 ms 632 KB Time limit exceeded
39 Execution timed out 1079 ms 612 KB Time limit exceeded
40 Execution timed out 1085 ms 632 KB Time limit exceeded
41 Execution timed out 1067 ms 1756 KB Time limit exceeded
42 Execution timed out 1083 ms 376 KB Time limit exceeded