| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1321925 | segfaulted | Art Exhibition (JOI18_art) | C++20 | 0 ms | 332 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
class Solve {
public:
void solve() {
int tuxn;
cin >> tuxn;
vector<pair<int,int>> tuxv(tuxn);
for (int tuxi = 0; tuxi < tuxn; tuxi++) {
int tuxa, tuxb;
cin >> tuxa >> tuxb;
tuxv[tuxi] = {tuxa, tuxb};
}
sort(tuxv.begin(), tuxv.end());
int tuxans = LLONG_MIN;
int tuxsum = 0, tuxl = 0;
for (int tuxr = 0; tuxr < tuxn; tuxr++) {
tuxsum += tuxv[tuxr].second;
while (tuxv[tuxr].first - tuxv[tuxl].first > 1e18) {
tuxsum -= tuxv[tuxl].second;
tuxl++;
}
tuxans = max(tuxans, tuxsum - (tuxv[tuxr].first - tuxv[tuxl].first));
}
cout << tuxans << endl;
}
};
signed main(signed argc, char* argv[]) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
if (argc > 1 && string(argv[1]) == "allyst") {
freopen("in.case", "r", stdin);
freopen("out.case", "w", stdout);
}
Solve tuxz;
tuxz.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... | ||||
