답안 #90575

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
90575 2018-12-22T13:46:57 Z tjrwodnjs999 이상한 수열 (OJUZ10_bizarre) C++11
100 / 100
70 ms 5812 KB
#include <bits/stdc++.h>
using namespace std;
int arr[50005],arr2[50005],n,m,cnt,sum=1e9;
map<int,bool> Map;
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",arr+i); arr2[i]=arr[i];
        if(!Map[arr[i]]) Map[arr[i]]=1,cnt++;
    }
    scanf("%d",&m);
    sort(arr2,arr2+n);
    for(int i=0;i<n;i++){
        if(arr2[i]>=cnt){
            sum=arr2[i];
            break;
        }
    }
    printf("%d",m<=n?arr[m-1]:min(cnt+m-n-1,sum));
}

Compilation message

bizarre.cpp: In function 'int main()':
bizarre.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
bizarre.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",arr+i); arr2[i]=arr[i];
         ~~~~~^~~~~~~~~~~~
bizarre.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&m);
     ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 596 KB Output is correct
3 Correct 2 ms 372 KB Output is correct
4 Correct 2 ms 448 KB Output is correct
5 Correct 2 ms 676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 708 KB Output is correct
2 Correct 2 ms 708 KB Output is correct
3 Correct 2 ms 708 KB Output is correct
4 Correct 2 ms 696 KB Output is correct
5 Correct 2 ms 708 KB Output is correct
6 Correct 2 ms 676 KB Output is correct
7 Correct 2 ms 676 KB Output is correct
8 Correct 2 ms 708 KB Output is correct
9 Correct 2 ms 708 KB Output is correct
10 Correct 2 ms 676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1220 KB Output is correct
2 Correct 30 ms 3812 KB Output is correct
3 Correct 13 ms 1800 KB Output is correct
4 Correct 10 ms 1628 KB Output is correct
5 Correct 4 ms 964 KB Output is correct
6 Correct 24 ms 2776 KB Output is correct
7 Correct 7 ms 1220 KB Output is correct
8 Correct 5 ms 1220 KB Output is correct
9 Correct 36 ms 5696 KB Output is correct
10 Correct 10 ms 1384 KB Output is correct
11 Correct 7 ms 1220 KB Output is correct
12 Correct 36 ms 5460 KB Output is correct
13 Correct 4 ms 1220 KB Output is correct
14 Correct 37 ms 4760 KB Output is correct
15 Correct 8 ms 1220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 5696 KB Output is correct
2 Correct 10 ms 5696 KB Output is correct
3 Correct 34 ms 5696 KB Output is correct
4 Correct 21 ms 5696 KB Output is correct
5 Correct 2 ms 5696 KB Output is correct
6 Correct 34 ms 5812 KB Output is correct
7 Correct 70 ms 5696 KB Output is correct
8 Correct 5 ms 5696 KB Output is correct
9 Correct 6 ms 5696 KB Output is correct
10 Correct 35 ms 5808 KB Output is correct
11 Correct 10 ms 5696 KB Output is correct
12 Correct 4 ms 5696 KB Output is correct
13 Correct 8 ms 5696 KB Output is correct
14 Correct 7 ms 5696 KB Output is correct
15 Correct 5 ms 5696 KB Output is correct