Submission #273249

# Submission time Handle Problem Language Result Execution time Memory
273249 2020-08-19T04:35:37 Z 송준혁(#5100) A Game with Grundy (CCO20_day1problem1) C++17
0 / 25
0 ms 256 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);
		if (h*Y % v) V.pb(pii(x-h*Y/v, 1)), V.pb(pii(x+h*Y/v+1, -1));
		else V.pb(pii(x-h*Y/v+1, 1)), V.pb(pii(x+h*Y/v, -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 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -