답안 #13723

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
13723 2015-03-28T15:10:50 Z gs14004 즐거운 채소 기르기 (JOI14_growing) C++14
0 / 100
14 ms 1084 KB
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
    int n,a[5005];
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        scanf("%d",&a[i]);
    }
    int ret = 0;
    for (int i=0; i<n; i++) {
        int p = (int)(min_element(a,a+n) - a);
        int cnt1 = 0, cnt2 = 0;
        for (int i=0; i<p; i++) {
            if(a[i] <= 1e9) cnt1++;
        }
        for (int i=p+1; i<n; i++) {
            if(a[i] <= 1e9) cnt2++;
        }
        a[p] = 2e9;
        ret += min(cnt1,cnt2);
    }
    printf("%d",ret);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 0 ms 1084 KB Output is correct
8 Correct 0 ms 1084 KB Output is correct
9 Correct 0 ms 1084 KB Output is correct
10 Incorrect 0 ms 1084 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Incorrect 0 ms 1084 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Incorrect 14 ms 1084 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1080 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -