Submission #273300

# Submission time Handle Problem Language Result Execution time Memory
273300 2020-08-19T04:46:41 Z 송준혁(#5100) A Game with Grundy (CCO20_day1problem1) C++17
25 / 25
87 ms 5468 KB
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<LL,LL> pii;

int N;
LL Y, L, R;
LL ans[101010];
vector<pii> V;

int main(){
	scanf("%d", &N);
	scanf("%lld %lld %lld", &L, &R, &Y);
	for (int i=1; i<=N; i++){
		LL x, v, h;
		scanf("%lld %lld %lld", &x, &v, &h);
		LL dx=(h*Y-1)/v;
		V.pb(pii(max(x-dx, L), 1)), V.pb(pii(x+dx+1, -1));
	}
	sort(V.begin(), V.end());
	int s=0, k=L;
	for (pii t : V){
		if (t.fi > R) break;
		ans[s] += t.fi-k;
		s += t.se, k = t.fi;
	}
	ans[s] += R-k+1;
	for (int i=0; i<=N; i++) printf("%lld\n", ans[i]), ans[i+1]+=ans[i];
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |  scanf("%d", &N);
      |  ~~~~~^~~~~~~~~~
Main.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%lld %lld %lld", &L, &R, &Y);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |   scanf("%lld %lld %lld", &x, &v, &h);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 69 ms 5048 KB Output is correct
4 Correct 78 ms 5048 KB Output is correct
5 Correct 75 ms 5088 KB Output is correct
6 Correct 77 ms 4608 KB Output is correct
7 Correct 58 ms 5212 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 69 ms 5048 KB Output is correct
4 Correct 78 ms 5048 KB Output is correct
5 Correct 75 ms 5088 KB Output is correct
6 Correct 77 ms 4608 KB Output is correct
7 Correct 58 ms 5212 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 87 ms 5408 KB Output is correct
10 Correct 80 ms 5468 KB Output is correct
11 Correct 75 ms 5440 KB Output is correct
12 Correct 77 ms 5344 KB Output is correct
13 Correct 65 ms 5468 KB Output is correct