# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
972957 | 2024-05-01T10:46:22 Z | oyber | Art Exhibition (JOI18_art) | C++14 | 1 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); vector<pair<int, int>> v; for (int i = 0; i < n; i++) { int a, b; scanf("%d %d", &a, &b); v.push_back(make_pair(a, b)); } sort(v.begin(), v.end()); int score = v[0].second; int best_score = score; for (int i = 1; i < n; i++) { int dist = v[i].first - v[i-1].first; int diff = v[i].second - dist; if (score+diff > v[i].second) { score += diff; } else { score = v[i].second; } if (score > best_score) { best_score = score; } //printf("%d\n", score); } printf("%d\n", best_score); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |