Submission #23480

#TimeUsernameProblemLanguageResultExecution timeMemory
23480TAMREF이상한 수열 (OJUZ10_bizarre)C++11
62 / 100
23 ms11392 KiB
#include <bits/stdc++.h> using namespace std; int S[200000], A[2000005], cnt[200000]; const int bias=1000000; int main(){ int N,M; scanf("%d",&N); for(int i=1;i<=N;i++){ scanf("%d",&S[i]); cnt[i]=cnt[i-1]+(A[S[i]+bias]++?0:1); } scanf("%d",&M); if(M<=N) return !printf("%d\n",S[M]); cnt[N+1]=cnt[N]; for(int i=N+2;i<=M;i++) cnt[i]=cnt[i-1]+(A[cnt[i-1]+bias]++?0:1); return !printf("%d\n",cnt[M]); }

Compilation message (stderr)

bizarre.cpp: In function 'int main()':
bizarre.cpp:6:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N,M; scanf("%d",&N);
                            ^
bizarre.cpp:8:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&S[i]);
                          ^
bizarre.cpp:10:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     } scanf("%d",&M);
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...