Submission #420381

# Submission time Handle Problem Language Result Execution time Memory
420381 2021-06-08T10:20:26 Z Nicholas_Patrick Autobahn (COI21_autobahn) C++17
20 / 100
1 ms 304 KB
#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(100, 0);
	vector<int> pay(100, 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<=100; 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);
}

Compilation message

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 time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 280 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 280 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Runtime error 1 ms 304 KB Execution killed with signal 6
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 280 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Runtime error 1 ms 304 KB Execution killed with signal 6
13 Halted 0 ms 0 KB -