# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
30701 | 2017-07-26T07:35:34 Z | waleed_jubeh | 선물상자 (IOI15_boxes) | C++14 | 2 ms | 376 KB |
#include "boxes.h" #include<algorithm> #include<map> using namespace std; long long delivery(int N, int K, int L, int p[]) { map<int,bool>visited; int diameter=L/2; long long int cost=0; long long int remain=0; long long visitor=0;; bool x=false; int temp=K; long long pos=0; for(int i=0;i<N;i++) { if(x==true){ if(!visited[p[i]]) { temp--; if(temp==0 ||i==N-1) { x=false; } visited[p[i]]++; } continue; } if(!visited[p[i]]){ if(p[i]>diameter){//after if(abs(p[i]-cost)>cost+L-p[i]) { cost+=(L-p[i]+cost)*2; temp--; x=true; pos=p[i]; }else { cost+=p[i]-cost; temp--; } }else{//before cost+=p[i]-cost; temp--; } visited[p[i]]++; if(temp==0|| i==N-1){ if(L-p[i]<p[i]) cost+=L-p[i]; else cost+=p[i]; temp=K; } } } return cost; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |