답안 #582434

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
582434 2022-06-23T18:34:51 Z Mystic03 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include <vector>
#include <iostream>

#define int long long
using namespace std;
int32_t besthub(int32_t n, int32_t L, int32_t X[], long long B){
	
	int from = 0;
	int to = 0;
	
	long long cost = 0;
	int res = 1;
	while (true) {
		int currRange = to - from + 1;
		to++;
		if (to >= n) break;

		int newDist = X[to] - X[to - 1];
		cost += (long long)currRange * newDist;

		while (cost > B) {
			cost -= X[to] - X[from];
			from++;
		}

		res = max(res, to - from + 1);
	}
	return res;
}
int32_t main() {
	int a, b, c;
	cin >> a >> b >> c;
	vector<int32_t> v(a);
	for (auto& x : v) cin >> x;
	cout << besthub(a, b, v.data(), c) << endl;
	system("PAUSE");
}

Compilation message

ricehub.cpp: In function 'int32_t main()':
ricehub.cpp:36:8: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |  system("PAUSE");
      |  ~~~~~~^~~~~~~~~
/usr/bin/ld: /tmp/cctmiGnr.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccmJ5o4o.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status