Submission #14595

#TimeUsernameProblemLanguageResultExecution timeMemory
14595ics0503이상한 수열 (OJUZ10_bizarre)C++98
0 / 100
1000 ms8896 KiB
#include <stdio.h> #define MAX 1000001 int arr[MAX]; int check[MAX]; int main() { int n; scanf("%d", &n); int i, j; for (i = 1; i <= n; i++) scanf("%d", &arr[i]); for (i = 1; i <= n; i++) { check[i] = 1; for (j = 1; j <= n; j++) { if (i == j) continue; if (arr[i] == arr[j] &&check[j] == 0) { check[j] = 1; arr[j] = 0; } } } int a = 0; for (i = 1; i <= n; i++) { if (arr[i] != 0) a += 1; } int m; scanf("%d", &m); arr[n + 1] = a; int sum = a; for (i = n + 1; i <= m; i++) { sum += 1; for (j = 1; j <= n; j++) { if (arr[i] == arr[j]) { sum -= 1; break; } } arr[i + 1] = sum; } printf("%d", arr[m]); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...