답안 #145560

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
145560 2019-08-20T11:49:18 Z surface03 줄 세우기 (KOI13_jul) C++14
22 / 22
169 ms 15036 KB
#include<bits/stdc++.h>
using namespace std;
int a[1000010],b[1000010];
int main(){
    int n,x,i,ans=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&x);
        a[x]=i;
    }
    b[1]=1;
    for(i=2;i<=n;i++){
        if(a[i-1]<a[i])b[i]=b[i-1]+1;
        else b[i]=1;
        ans=max(ans,b[i]);
    }
    printf("%d",n-ans);
}

Compilation message

jul.cpp: In function 'int main()':
jul.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
jul.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
         ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 632 KB Output is correct
2 Correct 4 ms 504 KB Output is correct
3 Correct 4 ms 504 KB Output is correct
4 Correct 4 ms 504 KB Output is correct
5 Correct 4 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 8 ms 888 KB Output is correct
3 Correct 14 ms 1400 KB Output is correct
4 Correct 28 ms 2508 KB Output is correct
5 Correct 54 ms 4936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 87 ms 7560 KB Output is correct
2 Correct 122 ms 10456 KB Output is correct
3 Correct 140 ms 12664 KB Output is correct
4 Correct 165 ms 14812 KB Output is correct
5 Correct 166 ms 14832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 166 ms 15036 KB Output is correct
2 Correct 165 ms 14956 KB Output is correct
3 Correct 166 ms 14840 KB Output is correct
4 Correct 167 ms 14948 KB Output is correct
5 Correct 169 ms 14992 KB Output is correct