Submission #14339

# Submission time Handle Problem Language Result Execution time Memory
14339 2015-05-12T07:36:50 Z Namnamseo 이상한 수열 (OJUZ10_bizarre) C++
100 / 100
124 ms 8932 KB
#include <cstdio>
#include <set>

using namespace std;
set<int> s;
int n;
int data[50010];

int main()
{
    scanf("%d",&n);
    int i;
    for(i=1;i<=n;++i) scanf("%d",data+i);
    int om,m;
    scanf("%d",&m);
    if(m<=n){
        printf("%d\n",data[m]);
    } else {
        for(i=1;i<=n;++i) s.insert(data[i]);
        m-=n+1;
        set<int>::iterator it;
        for(i=1;m;++i){
            if(s.lower_bound(s.size())==s.end()){
                break;
            }
            if(s.find(s.size()) != s.end()){
                m=0;
                break;
            }
            --m;
            s.insert(s.size());
        }
        if(m){
            printf("%d\n",s.size()+m);
        } else printf("%d\n",s.size());
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1408 KB Output is correct
2 Correct 0 ms 1408 KB Output is correct
3 Correct 0 ms 1408 KB Output is correct
4 Correct 0 ms 1408 KB Output is correct
5 Correct 0 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1408 KB Output is correct
2 Correct 0 ms 1408 KB Output is correct
3 Correct 0 ms 1408 KB Output is correct
4 Correct 0 ms 1408 KB Output is correct
5 Correct 0 ms 1408 KB Output is correct
6 Correct 0 ms 1408 KB Output is correct
7 Correct 0 ms 1408 KB Output is correct
8 Correct 0 ms 1408 KB Output is correct
9 Correct 0 ms 1408 KB Output is correct
10 Correct 0 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1804 KB Output is correct
2 Correct 7 ms 1408 KB Output is correct
3 Correct 10 ms 2860 KB Output is correct
4 Correct 20 ms 1936 KB Output is correct
5 Correct 4 ms 1408 KB Output is correct
6 Correct 0 ms 1408 KB Output is correct
7 Correct 8 ms 1408 KB Output is correct
8 Correct 6 ms 1408 KB Output is correct
9 Correct 2 ms 1408 KB Output is correct
10 Correct 0 ms 1408 KB Output is correct
11 Correct 4 ms 1804 KB Output is correct
12 Correct 7 ms 1408 KB Output is correct
13 Correct 7 ms 1408 KB Output is correct
14 Correct 0 ms 1672 KB Output is correct
15 Correct 5 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 3652 KB Output is correct
2 Correct 10 ms 1408 KB Output is correct
3 Correct 21 ms 3388 KB Output is correct
4 Correct 5 ms 1408 KB Output is correct
5 Correct 2 ms 1672 KB Output is correct
6 Correct 18 ms 2860 KB Output is correct
7 Correct 24 ms 3652 KB Output is correct
8 Correct 0 ms 1804 KB Output is correct
9 Correct 124 ms 8932 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 7 ms 1408 KB Output is correct
12 Correct 7 ms 1408 KB Output is correct
13 Correct 5 ms 1408 KB Output is correct
14 Correct 11 ms 1936 KB Output is correct
15 Correct 13 ms 1408 KB Output is correct