답안 #14184

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14184 2015-05-03T09:28:40 Z ainu7 이상한 수열 (OJUZ10_bizarre) C++
100 / 100
49 ms 4160 KB
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

int main()
{
  int N;
  cin >> N;

  vector<int> V(N);
  set<int> S;
  for (int i=0; i<N; i++) {
    cin >> V[i];
    S.insert(V[i]);
  }
  
  int M;
  cin >> M;
  M --;

  if (M < N) { cout << V[M] << endl; return 0; }

  int sz = S.size();
  S.insert(1999999999);
  int last = *(S.lower_bound(sz));

  M -= N;
  cout << min(sz + M, last) << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1720 KB Output is correct
2 Correct 0 ms 1720 KB Output is correct
3 Correct 0 ms 1720 KB Output is correct
4 Correct 0 ms 1720 KB Output is correct
5 Correct 0 ms 1720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1720 KB Output is correct
2 Correct 0 ms 1720 KB Output is correct
3 Correct 0 ms 1720 KB Output is correct
4 Correct 0 ms 1720 KB Output is correct
5 Correct 0 ms 1720 KB Output is correct
6 Correct 0 ms 1720 KB Output is correct
7 Correct 0 ms 1720 KB Output is correct
8 Correct 0 ms 1720 KB Output is correct
9 Correct 0 ms 1720 KB Output is correct
10 Correct 0 ms 1720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 2116 KB Output is correct
2 Correct 22 ms 1916 KB Output is correct
3 Correct 31 ms 2444 KB Output is correct
4 Correct 10 ms 1880 KB Output is correct
5 Correct 13 ms 1908 KB Output is correct
6 Correct 45 ms 4160 KB Output is correct
7 Correct 41 ms 3896 KB Output is correct
8 Correct 9 ms 2248 KB Output is correct
9 Correct 13 ms 1872 KB Output is correct
10 Correct 4 ms 1984 KB Output is correct
11 Correct 5 ms 1720 KB Output is correct
12 Correct 31 ms 3368 KB Output is correct
13 Correct 9 ms 1720 KB Output is correct
14 Correct 46 ms 4160 KB Output is correct
15 Correct 16 ms 1916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1880 KB Output is correct
2 Correct 21 ms 1916 KB Output is correct
3 Correct 49 ms 4160 KB Output is correct
4 Correct 10 ms 1720 KB Output is correct
5 Correct 0 ms 1720 KB Output is correct
6 Correct 31 ms 2444 KB Output is correct
7 Correct 12 ms 1872 KB Output is correct
8 Correct 40 ms 4160 KB Output is correct
9 Correct 8 ms 2116 KB Output is correct
10 Correct 14 ms 1916 KB Output is correct
11 Correct 4 ms 1984 KB Output is correct
12 Correct 14 ms 1908 KB Output is correct
13 Correct 0 ms 1720 KB Output is correct
14 Correct 42 ms 3896 KB Output is correct
15 Correct 32 ms 3368 KB Output is correct