답안 #2631

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
2631 2013-07-28T10:50:02 Z kipa00 줄 세우기 (KOI13_jul) C++
22 / 22
176 ms 4992 KB
#include <cstdio>
int a[1000001];

int main() {
	int N, i, max = -1, cnt = 0;
	int last = -1;
	scanf("%d", &N);
	for (i=1; i<=N; ++i) {
		int j;
		scanf("%d", &j);
		a[j] = i;
	}
	for (i=1; i<=N; ++i) {
		if (last < a[i]) {
			++cnt;
		} else {
			if (max < cnt) {
				max = cnt;
			}
			cnt = 0;
		}
		last = a[i];
	}
	printf("%d\n", N - max - 1);
	return 0;
}
# 결과 실행 시간 메모리 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 0 ms 4992 KB Output is correct
2 Correct 4 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 76 ms 4992 KB Output is correct
2 Correct 112 ms 4992 KB Output is correct
3 Correct 132 ms 4992 KB Output is correct
4 Correct 168 ms 4992 KB Output is correct
5 Correct 168 ms 4992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 160 ms 4992 KB Output is correct
2 Correct 168 ms 4992 KB Output is correct
3 Correct 160 ms 4992 KB Output is correct
4 Correct 176 ms 4992 KB Output is correct
5 Correct 156 ms 4992 KB Output is correct