Submission #78758

# Submission time Handle Problem Language Result Execution time Memory
78758 2018-10-08T15:41:12 Z ksmzzang2003 공주님의 정원 (KOI11_flower) C++11
18 / 18
49 ms 7488 KB
#include <stdio.h>
#include <algorithm>
#define fst first
#define snd second
using namespace std;

int n;
pair<int, int> f[100001];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int a, b, c, d;
		scanf("%d %d %d %d", &a, &b, &c, &d);
		f[i].fst = a * 100 + b, f[i].snd = c * 100 + d;
	}

	sort(f, f + n);

	int date = 301, flag = 0, temp = 0, ans = 0, i = -1;
	while (date <= 1130 && i < n) {
		flag = 0, i++;
		for (int j = i; j < n; j++) {
			if (f[j].fst > date) break;
			if (temp < f[j].snd) temp = f[j].snd, flag = 1, i = j;
		}
		if (flag) date = temp, ans++;
		else {
			printf("0");
			return 0;
		}
	}

	printf("%d", ans);

	return 0;
}

Compilation message

flower.cpp: In function 'int main()':
flower.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
flower.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d %d", &a, &b, &c, &d);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 4 ms 756 KB Output is correct
6 Correct 6 ms 948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1236 KB Output is correct
2 Correct 13 ms 1504 KB Output is correct
3 Correct 16 ms 1852 KB Output is correct
4 Correct 19 ms 2400 KB Output is correct
5 Correct 28 ms 2936 KB Output is correct
6 Correct 30 ms 3524 KB Output is correct
7 Correct 33 ms 4360 KB Output is correct
8 Correct 49 ms 5548 KB Output is correct
9 Correct 49 ms 6440 KB Output is correct
10 Correct 49 ms 7488 KB Output is correct