Submission #13724

# Submission time Handle Problem Language Result Execution time Memory
13724 2015-03-28T15:13:13 Z gs14004 즐거운 채소 기르기 (JOI14_growing) C++14
45 / 100
209 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 && a[i] > a[p]) cnt1++;
        }
        for (int i=p+1; i<n; i++) {
            if(a[i] <= 1e9 && a[i] > a[p]) cnt2++;
        }
        a[p] = 2e9;
        ret += min(cnt1,cnt2);
    }
    printf("%d",ret);
}
# Verdict Execution time Memory 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 Correct 0 ms 1084 KB Output is correct
# Verdict Execution time Memory 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 Correct 0 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 14 ms 1084 KB Output is correct
3 Correct 30 ms 1084 KB Output is correct
4 Correct 98 ms 1084 KB Output is correct
5 Correct 149 ms 1084 KB Output is correct
6 Correct 184 ms 1084 KB Output is correct
7 Correct 139 ms 1084 KB Output is correct
8 Correct 162 ms 1084 KB Output is correct
9 Correct 209 ms 1084 KB Output is correct
10 Correct 151 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1080 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -