Submission #795909

# Submission time Handle Problem Language Result Execution time Memory
795909 2023-07-27T21:41:35 Z rainboy 줄 세우기 (KOI13_jul) C
22 / 22
119 ms 10900 KB
#include <stdio.h>

#define N	1000000

int max(int a, int b) { return a > b ? a : b; }

int main() {
	static int ii[N];
	int n, i, a, k_, k;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &a), a--;
		ii[a] = i;
	}
	k_ = k = 1;
	for (a = 1; a < n; a++)
		k_ = max(k_, k = (ii[a - 1] > ii[a] ? 0 : k) + 1);
	printf("%d\n", n - k_);
	return 0;
}

Compilation message

jul.c: In function 'main':
jul.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
jul.c:13:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d", &a), a--;
      |   ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 296 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 4 ms 596 KB Output is correct
3 Correct 8 ms 956 KB Output is correct
4 Correct 19 ms 1792 KB Output is correct
5 Correct 31 ms 3520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 5512 KB Output is correct
2 Correct 69 ms 7588 KB Output is correct
3 Correct 83 ms 9204 KB Output is correct
4 Correct 117 ms 10860 KB Output is correct
5 Correct 98 ms 10856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 102 ms 10836 KB Output is correct
2 Correct 119 ms 10804 KB Output is correct
3 Correct 102 ms 10836 KB Output is correct
4 Correct 100 ms 10852 KB Output is correct
5 Correct 100 ms 10900 KB Output is correct