# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
128453 | 2019-07-11T00:00:34 Z | dragonslayerit | Coin Collecting (JOI19_ho_t4) | C++14 | 2 ms | 376 KB |
#include <cstdio> #include <algorithm> #include <stdint.h> struct Point{ int64_t x,y; void read(){ scanf("%ld %ld",&x,&y); } bool operator<(Point p)const{ return x<p.x; } }ps[200005]; int main(){ int N; scanf("%d",&N); for(int i=0;i<N*2;i++){ ps[i].read(); } std::sort(ps,ps+N*2); int64_t cost=0; for(int i=0;i<N*2;i++){ int64_t x=i/2+1; cost+=std::abs(ps[i].x-x); ps[i].x=x; std::swap(ps[i].x,ps[i].y); } for(int i=0;i<N;i++){ std::sort(ps+i*2,ps+(i+1)*2); cost+=std::abs(ps[i*2].x-1); cost+=std::abs(ps[i*2+1].x-2); } printf("%ld\n",cost); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 252 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Incorrect | 2 ms | 376 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 252 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Incorrect | 2 ms | 376 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 252 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Incorrect | 2 ms | 376 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |