답안 #7735

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
7735 2014-08-17T05:24:37 Z gs14004 줄 세우기 (KOI13_jul) C++
22 / 22
160 ms 4992 KB
#include <cstdio>
int n,a[1000005];
int isinCumul=1,howMuch=1,max;
int main(){
    int t;
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        scanf("%d",&t);
        a[t]=i+1;
    }
    for (int i=2; i<=n; i++) {
        if(a[i-1]<a[i]){
            isinCumul=1;
            howMuch++;
            if(max<howMuch) max=howMuch;
        }
        else if(isinCumul){
            isinCumul=0;
            if(max<howMuch) max=howMuch;
            howMuch=1;
        }
    }
    printf("%d",n-max);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4992 KB Output is correct
2 Correct 0 ms 4992 KB Output is correct
3 Correct 0 ms 4992 KB Output is correct
4 Correct 0 ms 4992 KB Output is correct
5 Correct 0 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4992 KB Output is correct
2 Correct 0 ms 4992 KB Output is correct
3 Correct 0 ms 4992 KB Output is correct
4 Correct 0 ms 4992 KB Output is correct
5 Correct 0 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4992 KB Output is correct
2 Correct 0 ms 4992 KB Output is correct
3 Correct 0 ms 4992 KB Output is correct
4 Correct 0 ms 4992 KB Output is correct
5 Correct 0 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 8 ms 4992 KB Output is correct
3 Correct 12 ms 4992 KB Output is correct
4 Correct 24 ms 4992 KB Output is correct
5 Correct 52 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 4992 KB Output is correct
2 Correct 116 ms 4992 KB Output is correct
3 Correct 148 ms 4992 KB Output is correct
4 Correct 160 ms 4992 KB Output is correct
5 Correct 160 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 152 ms 4992 KB Output is correct
2 Correct 144 ms 4992 KB Output is correct
3 Correct 152 ms 4992 KB Output is correct
4 Correct 144 ms 4992 KB Output is correct
5 Correct 148 ms 4992 KB Output is correct