이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize ("O3")
#pragma GCC target ("avx,avx2")
#include <iostream>
using namespace std;
typedef long long ll;
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define int ll
const int N = 2e5;
const int INF = 1e9;
struct rudina {
int x, g, d;
} a[N];
int n, ans;
main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
fo(i, 1, n, 1) {
cin >> a[i].x >> a[i].g >> a[i].d;
//pref[i] = pref[i - 1] + a[i].g;
}
fo(i, 1, n, 1) {
int power = 0, gold = 0, ansGold = 0;
fo(j, i, n, 1) {
power += a[j].d;
gold += a[j].g;
if(power >= a[j].x - a[i].x) {
ansGold = gold;
}
}
ans = max(ans, ansGold);
}
cout << ans;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
divide.cpp:22:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main () {
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |