# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
677464 | 2023-01-03T11:54:25 Z | mjhmjh1104 | None (JOI15_walls) | C++17 | 31 ms | 972 KB |
#include <cstdio> #include <vector> #include <utility> #include <algorithm> using namespace std; int n, m; vector<pair<int, int>> v; long long res; int main() { scanf("%d%d", &n, &m); v.resize(n); for (auto &i: v) scanf("%d%d", &i.first, &i.second); for (int i = 0; i < m; i++) { int x; scanf("%d", &x); if (v[0].first <= x && x <= v[0].second) continue; if (v[0].first > x) res += v[0].first - x, v[0].second -= v[0].first - x, v[0].first = x; if (v[0].second < x) res += x - v[0].second, v[0].first += x - v[0].second, v[0].second = x; } printf("%lld", res); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 27 ms | 284 KB | Output is correct |
3 | Correct | 26 ms | 212 KB | Output is correct |
4 | Correct | 27 ms | 212 KB | Output is correct |
5 | Correct | 31 ms | 212 KB | Output is correct |
6 | Correct | 27 ms | 212 KB | Output is correct |
7 | Correct | 21 ms | 212 KB | Output is correct |
8 | Correct | 23 ms | 972 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 27 ms | 284 KB | Output is correct |
3 | Correct | 26 ms | 212 KB | Output is correct |
4 | Correct | 27 ms | 212 KB | Output is correct |
5 | Correct | 31 ms | 212 KB | Output is correct |
6 | Correct | 27 ms | 212 KB | Output is correct |
7 | Correct | 21 ms | 212 KB | Output is correct |
8 | Correct | 23 ms | 972 KB | Output is correct |
9 | Incorrect | 6 ms | 340 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |