답안 #20481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20481 2017-02-12T03:36:02 Z 볼빨간민돌이(#63, mindol) 복불복 (OJUZ11_luck) C++
0 / 100
1000 ms 1120 KB
#include <cstdio>
#include <algorithm>
#include <cstdlib>
using namespace std;

int n, k, a[101], b[101];

void sub1(){
	int t[101];
	sort(a+1, a+n+1);
	reverse(a+1, a+n+1);
	sort(b+1, b+n+1);
	int cnt=0;
	do{
		for(int i=1; i<=n; i++)
			t[i]=a[i]+b[i];
		sort(t+1, t+1+n);

		bool flag=true;
		for(int i=1; i<=k; i++){
            if(t+1+n - upper_bound(t+1, t+1+n, a[i]+b[i]) + 1 > k)
				flag=false;
		}
		if(flag) cnt++;
	}while(next_permutation(b+1, b+n+1));
	printf("%d", cnt);
	exit(0);
}

int main(){
	scanf("%d %d", &n, &k);
	for(int i=1; i<=n; i++)
		scanf("%d", &a[i]);
	for(int i=1; i<=n; i++)
		scanf("%d", &b[i]);

	sub1();
	return 0;
}

Compilation message

luck.cpp: In function 'int main()':
luck.cpp:31:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &k);
                        ^
luck.cpp:33:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
                     ^
luck.cpp:35:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &b[i]);
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1120 KB Output is correct
2 Incorrect 3 ms 1120 KB Output isn't correct
3 Correct 3 ms 1120 KB Output is correct
4 Incorrect 3 ms 1120 KB Output isn't correct
5 Correct 6 ms 1120 KB Output is correct
6 Correct 6 ms 1120 KB Output is correct
7 Correct 3 ms 1120 KB Output is correct
8 Correct 3 ms 1120 KB Output is correct
9 Correct 3 ms 1120 KB Output is correct
10 Incorrect 3 ms 1120 KB Output isn't correct
11 Incorrect 3 ms 1120 KB Output isn't correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
18 Correct 0 ms 1120 KB Output is correct
19 Correct 0 ms 1120 KB Output is correct
20 Correct 0 ms 1120 KB Output is correct
21 Correct 3 ms 1120 KB Output is correct
22 Correct 3 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 1120 KB Execution timed out
2 Execution timed out 1000 ms 1120 KB Execution timed out
3 Execution timed out 1000 ms 1120 KB Execution timed out
4 Execution timed out 1000 ms 1120 KB Execution timed out
5 Execution timed out 1000 ms 1120 KB Execution timed out
6 Execution timed out 1000 ms 1120 KB Execution timed out
7 Execution timed out 1000 ms 1120 KB Execution timed out
8 Execution timed out 1000 ms 1120 KB Execution timed out
9 Execution timed out 1000 ms 1120 KB Execution timed out
10 Correct 0 ms 1120 KB Output is correct
11 Correct 0 ms 1120 KB Output is correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Execution timed out 1000 ms 1120 KB Execution timed out
15 Execution timed out 1000 ms 1120 KB Execution timed out
16 Execution timed out 1000 ms 1120 KB Execution timed out
17 Execution timed out 1000 ms 1120 KB Execution timed out
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1120 KB Output is correct
2 Incorrect 3 ms 1120 KB Output isn't correct
3 Correct 3 ms 1120 KB Output is correct
4 Incorrect 3 ms 1120 KB Output isn't correct
5 Correct 6 ms 1120 KB Output is correct
6 Correct 6 ms 1120 KB Output is correct
7 Correct 3 ms 1120 KB Output is correct
8 Correct 3 ms 1120 KB Output is correct
9 Correct 3 ms 1120 KB Output is correct
10 Incorrect 3 ms 1120 KB Output isn't correct
11 Incorrect 3 ms 1120 KB Output isn't correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
18 Correct 0 ms 1120 KB Output is correct
19 Correct 0 ms 1120 KB Output is correct
20 Correct 0 ms 1120 KB Output is correct
21 Correct 3 ms 1120 KB Output is correct
22 Correct 3 ms 1120 KB Output is correct
23 Execution timed out 1000 ms 1120 KB Execution timed out
24 Execution timed out 1000 ms 1120 KB Execution timed out
25 Execution timed out 1000 ms 1120 KB Execution timed out
26 Execution timed out 1000 ms 1120 KB Execution timed out
27 Execution timed out 1000 ms 1120 KB Execution timed out
28 Execution timed out 1000 ms 1120 KB Execution timed out
29 Execution timed out 1000 ms 1120 KB Execution timed out
30 Execution timed out 1000 ms 1120 KB Execution timed out
31 Execution timed out 1000 ms 1120 KB Execution timed out
32 Execution timed out 1000 ms 1120 KB Execution timed out
33 Execution timed out 1000 ms 1120 KB Execution timed out
34 Execution timed out 1000 ms 1120 KB Execution timed out
35 Execution timed out 1000 ms 1120 KB Execution timed out
36 Execution timed out 1000 ms 1120 KB Execution timed out
37 Execution timed out 1000 ms 1120 KB Execution timed out
38 Execution timed out 1000 ms 1120 KB Execution timed out
39 Correct 363 ms 1120 KB Output is correct
40 Execution timed out 1000 ms 1120 KB Execution timed out
41 Execution timed out 1000 ms 1120 KB Execution timed out
42 Correct 46 ms 1120 KB Output is correct
43 Correct 709 ms 1120 KB Output is correct
44 Execution timed out 1000 ms 1120 KB Execution timed out
45 Execution timed out 1000 ms 1120 KB Execution timed out
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1120 KB Output is correct
2 Incorrect 3 ms 1120 KB Output isn't correct
3 Correct 3 ms 1120 KB Output is correct
4 Incorrect 3 ms 1120 KB Output isn't correct
5 Correct 6 ms 1120 KB Output is correct
6 Correct 6 ms 1120 KB Output is correct
7 Correct 3 ms 1120 KB Output is correct
8 Correct 3 ms 1120 KB Output is correct
9 Correct 3 ms 1120 KB Output is correct
10 Incorrect 3 ms 1120 KB Output isn't correct
11 Incorrect 3 ms 1120 KB Output isn't correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
18 Correct 0 ms 1120 KB Output is correct
19 Correct 0 ms 1120 KB Output is correct
20 Correct 0 ms 1120 KB Output is correct
21 Correct 3 ms 1120 KB Output is correct
22 Correct 3 ms 1120 KB Output is correct
23 Execution timed out 1000 ms 1120 KB Execution timed out
24 Execution timed out 1000 ms 1120 KB Execution timed out
25 Execution timed out 1000 ms 1120 KB Execution timed out
26 Execution timed out 1000 ms 1120 KB Execution timed out
27 Execution timed out 1000 ms 1120 KB Execution timed out
28 Execution timed out 1000 ms 1120 KB Execution timed out
29 Execution timed out 1000 ms 1120 KB Execution timed out
30 Execution timed out 1000 ms 1120 KB Execution timed out
31 Execution timed out 1000 ms 1120 KB Execution timed out
32 Correct 0 ms 1120 KB Output is correct
33 Correct 0 ms 1120 KB Output is correct
34 Correct 0 ms 1120 KB Output is correct
35 Correct 0 ms 1120 KB Output is correct
36 Execution timed out 1000 ms 1120 KB Execution timed out
37 Execution timed out 1000 ms 1120 KB Execution timed out
38 Execution timed out 1000 ms 1120 KB Execution timed out
39 Execution timed out 1000 ms 1120 KB Execution timed out
40 Execution timed out 1000 ms 1120 KB Execution timed out
41 Execution timed out 1000 ms 1120 KB Execution timed out
42 Execution timed out 1000 ms 1120 KB Execution timed out
43 Execution timed out 1000 ms 1120 KB Execution timed out
44 Execution timed out 1000 ms 1120 KB Execution timed out
45 Execution timed out 1000 ms 1120 KB Execution timed out
46 Execution timed out 1000 ms 1120 KB Execution timed out
47 Execution timed out 1000 ms 1120 KB Execution timed out
48 Execution timed out 1000 ms 1120 KB Execution timed out
49 Execution timed out 1000 ms 1120 KB Execution timed out
50 Execution timed out 1000 ms 1120 KB Execution timed out
51 Execution timed out 1000 ms 1120 KB Execution timed out
52 Execution timed out 1000 ms 1120 KB Execution timed out
53 Execution timed out 1000 ms 1120 KB Execution timed out
54 Execution timed out 1000 ms 1120 KB Execution timed out
55 Execution timed out 1000 ms 1120 KB Execution timed out
56 Execution timed out 1000 ms 1120 KB Execution timed out
57 Execution timed out 1000 ms 1120 KB Execution timed out
58 Execution timed out 1000 ms 1120 KB Execution timed out
59 Execution timed out 1000 ms 1120 KB Execution timed out
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1120 KB Output is correct
2 Incorrect 3 ms 1120 KB Output isn't correct
3 Correct 3 ms 1120 KB Output is correct
4 Incorrect 3 ms 1120 KB Output isn't correct
5 Correct 6 ms 1120 KB Output is correct
6 Correct 6 ms 1120 KB Output is correct
7 Correct 3 ms 1120 KB Output is correct
8 Correct 3 ms 1120 KB Output is correct
9 Correct 3 ms 1120 KB Output is correct
10 Incorrect 3 ms 1120 KB Output isn't correct
11 Incorrect 3 ms 1120 KB Output isn't correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
18 Correct 0 ms 1120 KB Output is correct
19 Correct 0 ms 1120 KB Output is correct
20 Correct 0 ms 1120 KB Output is correct
21 Correct 3 ms 1120 KB Output is correct
22 Correct 3 ms 1120 KB Output is correct
23 Execution timed out 1000 ms 1120 KB Execution timed out
24 Execution timed out 1000 ms 1120 KB Execution timed out
25 Execution timed out 1000 ms 1120 KB Execution timed out
26 Execution timed out 1000 ms 1120 KB Execution timed out
27 Execution timed out 1000 ms 1120 KB Execution timed out
28 Execution timed out 1000 ms 1120 KB Execution timed out
29 Execution timed out 1000 ms 1120 KB Execution timed out
30 Execution timed out 1000 ms 1120 KB Execution timed out
31 Execution timed out 1000 ms 1120 KB Execution timed out
32 Correct 0 ms 1120 KB Output is correct
33 Correct 0 ms 1120 KB Output is correct
34 Correct 0 ms 1120 KB Output is correct
35 Correct 0 ms 1120 KB Output is correct
36 Execution timed out 1000 ms 1120 KB Execution timed out
37 Execution timed out 1000 ms 1120 KB Execution timed out
38 Execution timed out 1000 ms 1120 KB Execution timed out
39 Execution timed out 1000 ms 1120 KB Execution timed out
40 Execution timed out 1000 ms 1120 KB Execution timed out
41 Execution timed out 1000 ms 1120 KB Execution timed out
42 Execution timed out 1000 ms 1120 KB Execution timed out
43 Execution timed out 1000 ms 1120 KB Execution timed out
44 Execution timed out 1000 ms 1120 KB Execution timed out
45 Execution timed out 1000 ms 1120 KB Execution timed out
46 Execution timed out 1000 ms 1120 KB Execution timed out
47 Execution timed out 1000 ms 1120 KB Execution timed out
48 Execution timed out 1000 ms 1120 KB Execution timed out
49 Execution timed out 1000 ms 1120 KB Execution timed out
50 Execution timed out 1000 ms 1120 KB Execution timed out
51 Execution timed out 1000 ms 1120 KB Execution timed out
52 Execution timed out 1000 ms 1120 KB Execution timed out
53 Execution timed out 1000 ms 1120 KB Execution timed out
54 Execution timed out 1000 ms 1120 KB Execution timed out
55 Execution timed out 1000 ms 1120 KB Execution timed out
56 Correct 363 ms 1120 KB Output is correct
57 Execution timed out 1000 ms 1120 KB Execution timed out
58 Execution timed out 1000 ms 1120 KB Execution timed out
59 Correct 46 ms 1120 KB Output is correct
60 Correct 709 ms 1120 KB Output is correct
61 Execution timed out 1000 ms 1120 KB Execution timed out
62 Execution timed out 1000 ms 1120 KB Execution timed out
63 Execution timed out 1000 ms 1120 KB Execution timed out
64 Execution timed out 1000 ms 1120 KB Execution timed out
65 Execution timed out 1000 ms 1120 KB Execution timed out
66 Execution timed out 1000 ms 1120 KB Execution timed out
67 Execution timed out 1000 ms 1120 KB Execution timed out
68 Execution timed out 1000 ms 1120 KB Execution timed out
69 Execution timed out 1000 ms 1120 KB Execution timed out
70 Execution timed out 1000 ms 1120 KB Execution timed out
71 Execution timed out 1000 ms 1120 KB Execution timed out
72 Execution timed out 1000 ms 1120 KB Execution timed out
73 Execution timed out 1000 ms 1120 KB Execution timed out
74 Execution timed out 1000 ms 1120 KB Execution timed out
75 Execution timed out 1000 ms 1120 KB Execution timed out
76 Execution timed out 1000 ms 1120 KB Execution timed out
77 Execution timed out 1000 ms 1120 KB Execution timed out
78 Execution timed out 1000 ms 1120 KB Execution timed out
79 Execution timed out 1000 ms 1120 KB Execution timed out
80 Execution timed out 1000 ms 1120 KB Execution timed out
81 Execution timed out 1000 ms 1120 KB Execution timed out
82 Execution timed out 1000 ms 1120 KB Execution timed out
83 Execution timed out 1000 ms 1120 KB Execution timed out
84 Execution timed out 1000 ms 1120 KB Execution timed out
85 Execution timed out 1000 ms 1120 KB Execution timed out
86 Execution timed out 1000 ms 1120 KB Execution timed out
87 Execution timed out 1000 ms 1120 KB Execution timed out
88 Execution timed out 1000 ms 1120 KB Execution timed out
89 Execution timed out 1000 ms 1120 KB Execution timed out
90 Execution timed out 1000 ms 1120 KB Execution timed out
91 Execution timed out 1000 ms 1120 KB Execution timed out
92 Execution timed out 1000 ms 1120 KB Execution timed out
93 Execution timed out 1000 ms 1120 KB Execution timed out
94 Execution timed out 1000 ms 1120 KB Execution timed out
95 Execution timed out 1000 ms 1120 KB Execution timed out
96 Execution timed out 1000 ms 1120 KB Execution timed out
97 Execution timed out 1000 ms 1120 KB Execution timed out
98 Execution timed out 1000 ms 1120 KB Execution timed out
99 Execution timed out 1000 ms 1120 KB Execution timed out
100 Execution timed out 1000 ms 1120 KB Execution timed out
101 Execution timed out 1000 ms 1120 KB Execution timed out
102 Execution timed out 1000 ms 1120 KB Execution timed out
103 Execution timed out 1000 ms 1120 KB Execution timed out
104 Execution timed out 1000 ms 1120 KB Execution timed out
105 Execution timed out 1000 ms 1120 KB Execution timed out
106 Execution timed out 1000 ms 1120 KB Execution timed out
107 Execution timed out 1000 ms 1120 KB Execution timed out