Submission #1092537

# Submission time Handle Problem Language Result Execution time Memory
1092537 2024-09-24T10:40:04 Z sleepntsheep A Game with Grundy (CCO20_day1problem1) C++17
25 / 25
82 ms 12880 KB
#include<stdio.h>
#include<map>
using namespace std;
#define N 100005
int n,l,r,y,cn,f[N];

int main(){
	scanf("%d%d%d%d",&n,&l,&r,&y);
	map<int,int>e;
	for(int x,v,h,i=0;i<n;++i){
		scanf("%d%d%d",&x,&v,&h);
		int w=(y*h-1)/v;
		int st=max(l,x-w),ed=min(r+1,x+w+1);
		++e[st],--e[ed];
	}

	int x0=l;
	for(auto[x,ii]:e){
		f[cn]+=x-x0;
		x0=x;cn+=ii;
	}
	f[cn]+=r-x0+1;
	for(int i=0;i<=n;++i)printf("%d\n",f[i]),f[i+1]+=f[i];

}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%d%d%d%d",&n,&l,&r,&y);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d%d%d",&x,&v,&h);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 64 ms 7436 KB Output is correct
4 Correct 72 ms 10832 KB Output is correct
5 Correct 80 ms 10344 KB Output is correct
6 Correct 22 ms 2640 KB Output is correct
7 Correct 30 ms 5712 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 64 ms 7436 KB Output is correct
4 Correct 72 ms 10832 KB Output is correct
5 Correct 80 ms 10344 KB Output is correct
6 Correct 22 ms 2640 KB Output is correct
7 Correct 30 ms 5712 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 75 ms 12620 KB Output is correct
10 Correct 75 ms 12880 KB Output is correct
11 Correct 72 ms 12624 KB Output is correct
12 Correct 82 ms 12372 KB Output is correct
13 Correct 38 ms 8348 KB Output is correct