제출 #420384

#제출 시각아이디문제언어결과실행 시간메모리
420384Nicholas_PatrickAutobahn (COI21_autobahn)C++17
50 / 100
3 ms2764 KiB
#include <cstdio>
#include <queue>
using namespace std;

struct person{
	int l, r, t;
};
int main(){
	int n, k, x;
	scanf("%d%d%d", &n, &k, &x);
	vector<person> people(n);
	vector<int> count(1000, 0);
	vector<int> pay(1000, 0);
	for(auto& i : people){
		scanf("%d%d%d", &i.l, &i.t, &i.r), i.l--;
		for(int j=i.l; j<i.r; j++)
			count[j]++;
		for(int j=i.l+i.t; j<i.r; j++)
			pay[j]++;
	}
	int ans=0;
	for(int i=0; i+x<=1000; i++){
		int curr=0;
		for(int j=i; j<i+x; j++){
			if(count[j]>=k)
				curr+=pay[j];
		}
		ans=max(ans, curr);
	}
	printf("%d\n", ans);
}

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

autobahn.cpp: In function 'int main()':
autobahn.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%d%d", &n, &k, &x);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
autobahn.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d%d%d", &i.l, &i.t, &i.r), i.l--;
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...