# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
282148 | 2020-08-24T04:11:33 Z | 반딧불(#5757) | 방벽 (JOI15_walls) | C++17 | 3000 ms | 4088 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, k; ll a[200002], b[200002]; ll arr[200002]; ll ans[200002]; int main(){ scanf("%d %d", &n, &k); for(int i=1; i<=n; i++) scanf("%lld %lld", &a[i], &b[i]); for(int i=1; i<=k; i++) scanf("%lld", &arr[i]); for(int i=1; i<=k; i++){ for(int j=1; j<=n; j++){ if(a[j] <= arr[i] && arr[i] <= b[j]) continue; ll tmp; if(arr[i] < a[j]) tmp = arr[i] - a[j]; else tmp = arr[i] - b[j]; a[j] += tmp, b[j] += tmp, ans[j] += abs(tmp); } } for(int i=1; i<=n; i++){ printf("%lld\n", ans[i]); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 37 ms | 2040 KB | Output is correct |
3 | Correct | 42 ms | 4088 KB | Output is correct |
4 | Correct | 38 ms | 3832 KB | Output is correct |
5 | Correct | 59 ms | 3832 KB | Output is correct |
6 | Correct | 38 ms | 3832 KB | Output is correct |
7 | Correct | 37 ms | 3704 KB | Output is correct |
8 | Correct | 35 ms | 3840 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1678 ms | 1404 KB | Output is correct |
2 | Execution timed out | 3067 ms | 2424 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 37 ms | 2040 KB | Output is correct |
3 | Correct | 42 ms | 4088 KB | Output is correct |
4 | Correct | 38 ms | 3832 KB | Output is correct |
5 | Correct | 59 ms | 3832 KB | Output is correct |
6 | Correct | 38 ms | 3832 KB | Output is correct |
7 | Correct | 37 ms | 3704 KB | Output is correct |
8 | Correct | 35 ms | 3840 KB | Output is correct |
9 | Correct | 1678 ms | 1404 KB | Output is correct |
10 | Execution timed out | 3067 ms | 2424 KB | Time limit exceeded |
11 | Halted | 0 ms | 0 KB | - |