제출 #39384

#제출 시각아이디문제언어결과실행 시간메모리
3938414kg코알라 (JOI13_koala)C++11
50 / 100
2000 ms5888 KiB
#include <stdio.h>
#include <algorithm>
#include <queue>
#define LL long long

using namespace std;
int S, E, J, n;
long long P;
pair<int, long long> in[100001];
priority_queue<pair<long long, int> > Q;

int main() {
	int t;
	pair<long long, int> path;

	scanf("%d %d %d %lld %d", &S, &E, &J, &P, &n);
	for (int i = 1; i <= n; i++) scanf("%d %lld", &in[i].first, &in[i].second);
	sort(in + 1, in + n + 1);
	
	Q.push({ 0,S });
	for (int i = 1; i <= n; i++) {
		while (Q.top().second < in[i].first) {
			if (0); // Q.top().first==path.first
			else {
				path = Q.top(), Q.pop();
				t = (in[i].first - path.second) / J;
				if ((LL)path.second + (LL)J*(LL)t < (LL)in[i].first) t++;

				Q.push({ path.first - P*(LL)t, path.second + J*t });
			}
		}
		Q.push({ Q.top().first + in[i].second, in[i].first });
	}
	while (Q.top().second < E) Q.pop();
	printf("%lld", Q.top().first);
}

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

koala.cpp: In function 'int main()':
koala.cpp:16:47: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d %lld %d", &S, &E, &J, &P, &n);
                                               ^
koala.cpp:17:76: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 1; i <= n; i++) scanf("%d %lld", &in[i].first, &in[i].second);
                                                                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...