# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
56938 | 2018-07-13T08:58:28 Z | 김세빈(#1635) | 방벽 (JOI15_walls) | C++11 | 78 ms | 13484 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll A[202020], B[202020], P[202020]; ll n, m; int main() { ll i, j, s; scanf("%lld%lld", &n, &m); if(n > 1) return 0; for(i=1;i<=n;i++){ scanf("%lld%lld", A+i, B+i); } for(i=1;i<=m;i++){ scanf("%lld", P+i); } for(i=1;i<=n;i++){ s = 0; for(j=1;j<=m;j++){ if(P[j] < A[i]){ s += A[i] - P[j]; B[i] = B[i] - A[i] + P[j]; A[i] = P[j]; } if(P[j] > B[i]){ s += P[j] - B[i]; A[i] = P[j] - B[i] + A[i]; B[i] = P[j]; } } printf("%lld\n", s); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 63 ms | 2152 KB | Output is correct |
3 | Correct | 70 ms | 3852 KB | Output is correct |
4 | Correct | 71 ms | 5728 KB | Output is correct |
5 | Correct | 65 ms | 7740 KB | Output is correct |
6 | Correct | 78 ms | 9724 KB | Output is correct |
7 | Correct | 41 ms | 11596 KB | Output is correct |
8 | Correct | 63 ms | 13484 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 13484 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 63 ms | 2152 KB | Output is correct |
3 | Correct | 70 ms | 3852 KB | Output is correct |
4 | Correct | 71 ms | 5728 KB | Output is correct |
5 | Correct | 65 ms | 7740 KB | Output is correct |
6 | Correct | 78 ms | 9724 KB | Output is correct |
7 | Correct | 41 ms | 11596 KB | Output is correct |
8 | Correct | 63 ms | 13484 KB | Output is correct |
9 | Incorrect | 2 ms | 13484 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |