Submission #1106

# Submission time Handle Problem Language Result Execution time Memory
1106 2013-06-25T08:29:48 Z hana5505 줄 세우기 (KOI13_jul) C++
22 / 22
196 ms 8696 KB
#include<stdio.h>
int ar[1000001];
int aa[1000001];
int main()
{
	int n,i,b,mx=0,cnt=0;

	scanf("%d",&n);

	for(i=1;i<=n;i++){
		scanf("%d",&ar[i]);
		aa[ar[i]]=i;
	}

	cnt=1;
	b=aa[1];
	for(i=2;i<=n;i++){
		if(b<aa[i]) cnt++;
		else{
			if(cnt>mx) mx=cnt;
			cnt=1;
		}
		b=aa[i];
	}
	printf("%d",n-mx);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 8696 KB Output is correct
2 Correct 0 ms 8696 KB Output is correct
3 Correct 0 ms 8696 KB Output is correct
4 Correct 0 ms 8696 KB Output is correct
5 Correct 0 ms 8696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 8696 KB Output is correct
2 Correct 0 ms 8696 KB Output is correct
3 Correct 0 ms 8696 KB Output is correct
4 Correct 0 ms 8696 KB Output is correct
5 Correct 0 ms 8696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8696 KB Output is correct
2 Correct 1 ms 8696 KB Output is correct
3 Correct 1 ms 8696 KB Output is correct
4 Correct 1 ms 8696 KB Output is correct
5 Correct 1 ms 8696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8696 KB Output is correct
2 Correct 5 ms 8696 KB Output is correct
3 Correct 11 ms 8696 KB Output is correct
4 Correct 31 ms 8696 KB Output is correct
5 Correct 56 ms 8696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 8696 KB Output is correct
2 Correct 126 ms 8696 KB Output is correct
3 Correct 164 ms 8696 KB Output is correct
4 Correct 189 ms 8696 KB Output is correct
5 Correct 185 ms 8696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 196 ms 8696 KB Output is correct
2 Correct 188 ms 8696 KB Output is correct
3 Correct 186 ms 8696 KB Output is correct
4 Correct 188 ms 8696 KB Output is correct
5 Correct 187 ms 8696 KB Output is correct