Submission #14299

#TimeUsernameProblemLanguageResultExecution timeMemory
14299jalmal이상한 수열 (OJUZ10_bizarre)C++98
62 / 100
14 ms12996 KiB
#include <stdio.h> int N, M, inp[50005], chk[3000010], cnt; int main() { //freopen("input.txt", "r", stdin); int i, j; scanf("%d", &N); for(i = 1; i <= N; i ++) { scanf("%d", &inp[i]); if(!chk[inp[i] + 1000000]) cnt ++, chk[inp[i] + 1000000] = 1; } scanf("%d", &M); if(M <= N) { printf("%d\n", inp[M]); return 0; } for(i = N+1; i <= M; i ++) { if(chk[cnt + 1000000]) { printf("%d\n", cnt); return 0; } chk[cnt + 1000000] = 1; cnt ++; } printf("%d\n", --cnt); 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...