답안 #1189

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1189 2013-06-29T12:15:44 Z gs13068 줄 세우기 (KOI13_jul) C++
22 / 22
201 ms 12604 KB
#include<cstdio>

int a[1000000];
int b[1000001];
int dy[1000000];

int main()
{
	int i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		b[a[i]]=i;
	}
	for(i=0;i<n;i++)
	{
		if(a[i]>1&&b[a[i]-1]<i)
			dy[i]=dy[b[a[i]-1]]+1;
		else
			dy[i]=1;
	}
	for(i=1;i<n;i++)
	{
		if(dy[i]>dy[0])
			dy[0]=dy[i];
	}
	printf("%d",n-dy[0]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12604 KB Output is correct
2 Correct 0 ms 12604 KB Output is correct
3 Correct 0 ms 12604 KB Output is correct
4 Correct 0 ms 12604 KB Output is correct
5 Correct 0 ms 12604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12604 KB Output is correct
2 Correct 0 ms 12604 KB Output is correct
3 Correct 0 ms 12604 KB Output is correct
4 Correct 0 ms 12604 KB Output is correct
5 Correct 0 ms 12604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 12604 KB Output is correct
2 Correct 1 ms 12604 KB Output is correct
3 Correct 2 ms 12604 KB Output is correct
4 Correct 1 ms 12604 KB Output is correct
5 Correct 1 ms 12604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 12604 KB Output is correct
2 Correct 7 ms 12604 KB Output is correct
3 Correct 14 ms 12604 KB Output is correct
4 Correct 29 ms 12604 KB Output is correct
5 Correct 63 ms 12604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 12604 KB Output is correct
2 Correct 132 ms 12604 KB Output is correct
3 Correct 164 ms 12604 KB Output is correct
4 Correct 188 ms 12604 KB Output is correct
5 Correct 188 ms 12604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 201 ms 12604 KB Output is correct
2 Correct 189 ms 12604 KB Output is correct
3 Correct 185 ms 12604 KB Output is correct
4 Correct 199 ms 12604 KB Output is correct
5 Correct 193 ms 12604 KB Output is correct