# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
677483 | 2023-01-03T12:37:59 Z | 79brue | 방벽 (JOI15_walls) | C++17 | 3000 ms | 3636 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, k; ll a[200002], b[200002]; ll pnt[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", &pnt[i]); for(int i=1; i<=n; i++){ for(int j=1; j<=k; j++){ if(pnt[j] < a[i]){ ans[i] += a[i] - pnt[j]; b[i] -= (a[i] - pnt[j]); a[i] = pnt[j]; } else if(b[i] < pnt[j]){ ans[i] += pnt[j] - b[i]; a[i] += (pnt[j] - b[i]); b[i] = pnt[j]; } } printf("%lld\n", ans[i]); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 468 KB | Output is correct |
2 | Correct | 31 ms | 2412 KB | Output is correct |
3 | Correct | 24 ms | 2476 KB | Output is correct |
4 | Correct | 30 ms | 2416 KB | Output is correct |
5 | Correct | 23 ms | 2508 KB | Output is correct |
6 | Correct | 23 ms | 2500 KB | Output is correct |
7 | Correct | 21 ms | 2416 KB | Output is correct |
8 | Correct | 26 ms | 2380 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1910 ms | 1504 KB | Output is correct |
2 | Execution timed out | 3056 ms | 3636 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 468 KB | Output is correct |
2 | Correct | 31 ms | 2412 KB | Output is correct |
3 | Correct | 24 ms | 2476 KB | Output is correct |
4 | Correct | 30 ms | 2416 KB | Output is correct |
5 | Correct | 23 ms | 2508 KB | Output is correct |
6 | Correct | 23 ms | 2500 KB | Output is correct |
7 | Correct | 21 ms | 2416 KB | Output is correct |
8 | Correct | 26 ms | 2380 KB | Output is correct |
9 | Correct | 1910 ms | 1504 KB | Output is correct |
10 | Execution timed out | 3056 ms | 3636 KB | Time limit exceeded |
11 | Halted | 0 ms | 0 KB | - |