답안 #47605

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
47605 2018-05-05T14:30:23 Z RezwanArefin01 선물상자 (IOI15_boxes) C++11
10 / 100
2 ms 376 KB
#include "boxes.h"
#include <bits/stdc++.h> 
using namespace std;

typedef long long ll; 

ll delivery(int N, int K, int L, int p[]) {
    if(K == 1) {
    	ll tot = 0; 
    	for(int i = 0; i < N; i++) 
    		tot += 2 * min(p[i], L - p[i]); 
    	return tot; 
    }
    if(N == K) {
    	if(N == 1) return 2 * min(p[0], L - p[0]); 
    	ll mn = L; 
    	for(int i = 0; i < N - 1; i++) {
    		mn = min(mn, 2ll * (L + p[i] - p[i + 1])); 
    	}
    	return mn;
    }
}

Compilation message

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 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 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Incorrect 2 ms 256 KB Output isn't correct
11 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 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Incorrect 2 ms 256 KB Output isn't correct
11 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 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Incorrect 2 ms 256 KB Output isn't correct
11 Halted 0 ms 0 KB -