제출 #78758

#제출 시각아이디문제언어결과실행 시간메모리
78758ksmzzang2003공주님의 정원 (KOI11_flower)C++11
18 / 18
49 ms7488 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...