# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
95438 | 2019-02-01T07:56:22 Z | Retro3014 | 방벽 (JOI15_walls) | C++17 | 35 ms | 3304 KB |
#include <iostream> #include <algorithm> #include <vector> #include <stdio.h> typedef long long ll; using namespace std; int N, M; struct S{ int a, b; }; vector<S> v; vector<int> P; void solve1(){ ll ans = 0; int x = v[0].a, y = v[0].b; for(int i=0; i<P.size(); i++){ int now = P[i]; if(y<now){ ans += (ll)now-y; x += now-y; y = now; }else if(x>now){ ans += (ll)x-now; y -= x-now; x = now; } } printf("%lld", ans); } void solve2(){ } void solve3(){ } int main(){ scanf("%d%d", &N, &M); for(int i=0; i<N; i++){ S tmp; scanf("%d%d", &tmp.a, &tmp.b); v.push_back(tmp); } for(int i=0; i<M; i++){ int x; scanf("%d", &x); P.push_back(x); } if(N==1){ solve1(); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 504 KB | Output is correct |
2 | Correct | 35 ms | 3304 KB | Output is correct |
3 | Correct | 34 ms | 3176 KB | Output is correct |
4 | Correct | 35 ms | 3228 KB | Output is correct |
5 | Correct | 34 ms | 3176 KB | Output is correct |
6 | Correct | 34 ms | 3176 KB | Output is correct |
7 | Correct | 26 ms | 2952 KB | Output is correct |
8 | Correct | 30 ms | 3180 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 1140 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 504 KB | Output is correct |
2 | Correct | 35 ms | 3304 KB | Output is correct |
3 | Correct | 34 ms | 3176 KB | Output is correct |
4 | Correct | 35 ms | 3228 KB | Output is correct |
5 | Correct | 34 ms | 3176 KB | Output is correct |
6 | Correct | 34 ms | 3176 KB | Output is correct |
7 | Correct | 26 ms | 2952 KB | Output is correct |
8 | Correct | 30 ms | 3180 KB | Output is correct |
9 | Incorrect | 10 ms | 1140 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |