# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
282813 | 2020-08-25T02:26:25 Z | arnold518 | 방벽 (JOI15_walls) | C++14 | 3000 ms | 3736 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 2e5; int N, M; pii A[MAXN+10]; int B[MAXN+10]; int main() { scanf("%d%d", &N, &M); for(int i=1; i<=N; i++) scanf("%d%d", &A[i].first, &A[i].second); for(int i=1; i<=M; i++) scanf("%d", &B[i]); for(int j=1; j<=N; j++) { ll ans=0; for(int i=1; i<=M; i++) { if(A[j].first<=B[i] && B[i]<=A[j].second) continue; else if(B[i]<A[j].first) { int t=A[j].first-B[i]; ans+=t; A[j].first-=t; A[j].second-=t; } else if(B[i]>A[j].second) { int t=B[i]-A[j].second; ans+=t; A[j].first+=t; A[j].second+=t; } } printf("%lld\n", ans); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 40 ms | 3064 KB | Output is correct |
3 | Correct | 41 ms | 3064 KB | Output is correct |
4 | Correct | 41 ms | 3192 KB | Output is correct |
5 | Correct | 41 ms | 3064 KB | Output is correct |
6 | Correct | 50 ms | 3016 KB | Output is correct |
7 | Correct | 39 ms | 2808 KB | Output is correct |
8 | Correct | 34 ms | 3064 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2437 ms | 1600 KB | Output is correct |
2 | Execution timed out | 3059 ms | 3736 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 40 ms | 3064 KB | Output is correct |
3 | Correct | 41 ms | 3064 KB | Output is correct |
4 | Correct | 41 ms | 3192 KB | Output is correct |
5 | Correct | 41 ms | 3064 KB | Output is correct |
6 | Correct | 50 ms | 3016 KB | Output is correct |
7 | Correct | 39 ms | 2808 KB | Output is correct |
8 | Correct | 34 ms | 3064 KB | Output is correct |
9 | Correct | 2437 ms | 1600 KB | Output is correct |
10 | Execution timed out | 3059 ms | 3736 KB | Time limit exceeded |
11 | Halted | 0 ms | 0 KB | - |