Submission #130909

# Submission time Handle Problem Language Result Execution time Memory
130909 2019-07-16T08:29:29 Z 임유진(#3171) Bodyguards (CEOI10_bodyguards) C++14
50 / 100
449 ms 262148 KB
#include <stdio.h>
#include <algorithm>
#include <vector>

using namespace std;

#define MAXN 5005

int rbod[MAXN], rnum[MAXN], cbod[MAXN], cnum[MAXN];
vector<int> rv, cv;

int main() {
	int R, C;

	scanf("%d", &R);
	for(int i = 0; i < R; i++) scanf("%d%d", rbod + i, rnum + i);
	scanf("%d", &C);
	for(int i = 0; i < C; i++) scanf("%d%d", cbod + i, cnum + i);

	for(int i = 0; i < R; i++) for(int j = 0; j < rnum[i]; j++) rv.push_back(rbod[i]);
	for(int i = 0; i < C; i++) for(int j = 0; j < cnum[i]; j++) cv.push_back(cbod[i]);

	for(auto a : rv) {
		sort(cv.begin(), cv.end());
		for(int i = cv.size() - a; i < cv.size(); i++) cv[i]--;
	}

	sort(cv.begin(), cv.end());
	if(cv[0] != 0 || cv.back() != 0) printf("0");
	else printf("1");
	return 0;
}

Compilation message

bodyguards.cpp: In function 'int main()':
bodyguards.cpp:25:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = cv.size() - a; i < cv.size(); i++) cv[i]--;
                              ~~^~~~~~~~~~~
bodyguards.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &R);
  ~~~~~^~~~~~~~~~
bodyguards.cpp:16:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 0; i < R; i++) scanf("%d%d", rbod + i, rnum + i);
                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
bodyguards.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &C);
  ~~~~~^~~~~~~~~~
bodyguards.cpp:18:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 0; i < C; i++) scanf("%d%d", cbod + i, cnum + i);
                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 252 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 252 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 4 ms 380 KB Output is correct
4 Correct 4 ms 380 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 10 ms 376 KB Output is correct
10 Correct 11 ms 372 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 4 ms 376 KB Output is correct
13 Correct 4 ms 256 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
16 Correct 4 ms 376 KB Output is correct
17 Correct 11 ms 380 KB Output is correct
18 Correct 11 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 376 KB Output is correct
2 Correct 10 ms 256 KB Output is correct
3 Correct 10 ms 376 KB Output is correct
4 Correct 10 ms 376 KB Output is correct
5 Correct 12 ms 376 KB Output is correct
6 Correct 10 ms 256 KB Output is correct
7 Correct 10 ms 256 KB Output is correct
8 Correct 10 ms 256 KB Output is correct
9 Correct 11 ms 376 KB Output is correct
10 Correct 12 ms 376 KB Output is correct
11 Correct 11 ms 376 KB Output is correct
12 Correct 11 ms 376 KB Output is correct
13 Correct 12 ms 376 KB Output is correct
14 Correct 11 ms 376 KB Output is correct
15 Correct 11 ms 376 KB Output is correct
16 Correct 11 ms 380 KB Output is correct
17 Correct 12 ms 376 KB Output is correct
18 Correct 11 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 376 KB Output is correct
2 Correct 29 ms 504 KB Output is correct
3 Correct 25 ms 504 KB Output is correct
4 Correct 28 ms 376 KB Output is correct
5 Correct 21 ms 376 KB Output is correct
6 Correct 24 ms 376 KB Output is correct
7 Correct 22 ms 376 KB Output is correct
8 Correct 26 ms 432 KB Output is correct
9 Correct 32 ms 376 KB Output is correct
10 Correct 32 ms 380 KB Output is correct
11 Correct 32 ms 376 KB Output is correct
12 Correct 32 ms 376 KB Output is correct
13 Correct 33 ms 376 KB Output is correct
14 Correct 25 ms 376 KB Output is correct
15 Correct 32 ms 400 KB Output is correct
16 Correct 24 ms 376 KB Output is correct
17 Correct 32 ms 376 KB Output is correct
18 Correct 27 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 449 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 448 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 292 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -