# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
895001 | tamyte | Bulldozer (JOI17_bulldozer) | C++14 | 1 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define int int64_t
#define all(x) (x).begin(), (x).end()
#define UNIQUE(x) \
sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()
using pii = std::pair<int, int>;
using namespace std;
void setIO(string name = "")
{
cin.tie(0)->sync_with_stdio(0); // see /general/fast-io
if (name.size())
{
freopen((name + ".in").c_str(), "r", stdin); // see /general/input-output
freopen((name + ".out").c_str(), "w", stdout);
}
}
int MOD = 1e9 + 7;
int oo = 1e18;
struct st
{
int x, y, c;
};
void solve() {
#define test1
int n;
cin >> n;
vector<st> arr(n);
for (int i = 0; i < n; ++i) {
cin >> arr[i].x >> arr[i].y >> arr[i].c;
}
sort(arr.begin(), arr.end(), [&](const st& a, const st& b) {
return a.x < b.x;
});
int mx = 0, curr = 0;
for (int i = 0; i < n; ++i) {
// cout << arr[i].c << " -> ";
curr = max((int)0, curr + arr[i].c);
mx = max(mx, curr);
// cout << curr << " -> ";
}
// cout << "\n";
// cout << mx << " ";
sort(arr.begin(), arr.end(), [&](const st& a, const st& b) {
return a.y < b.y;
});
curr = 0;
for (int i = 0; i < n; ++i) {
curr = max((int)0, curr + arr[i].c);
mx = max(mx, curr);
}
cout << mx;
}
int32_t main () {
setIO(""); int t = 1;
#ifdef test
cin >> t;
#endif
while (t--) solve();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |