Submission #90574

# Submission time Handle Problem Language Result Execution time Memory
90574 2018-12-22T13:45:28 Z tjrwodnjs999 이상한 수열 (OJUZ10_bizarre) C++11
62 / 100
38 ms 6560 KB
#include <bits/stdc++.h>
using namespace std;
int arr[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);
        if(!Map[arr[i]]) Map[arr[i]]=1,cnt++;
    }
    scanf("%d",&m);
    sort(arr,arr+n);
    for(int i=0;i<n;i++){
        if(arr[i]>=cnt){
            sum=arr[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);
         ~~~~~^~~~~~~~~~~~
bizarre.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&m);
     ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Halted 0 ms 0 KB -
3 Incorrect 2 ms 508 KB Output isn't correct
4 Correct 2 ms 508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 684 KB Output is correct
2 Correct 2 ms 684 KB Output is correct
3 Correct 2 ms 1144 KB Output is correct
4 Correct 2 ms 684 KB Output is correct
5 Correct 2 ms 1040 KB Output is correct
6 Correct 2 ms 912 KB Output is correct
7 Correct 2 ms 912 KB Output is correct
8 Correct 2 ms 684 KB Output is correct
9 Correct 2 ms 1144 KB Output is correct
10 Correct 2 ms 912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1716 KB Output is correct
2 Correct 7 ms 1808 KB Output is correct
3 Correct 5 ms 1424 KB Output is correct
4 Correct 6 ms 1808 KB Output is correct
5 Incorrect 4 ms 1808 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 6196 KB Output is correct
2 Correct 5 ms 1808 KB Output is correct
3 Correct 10 ms 2236 KB Output is correct
4 Correct 5 ms 2088 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 8 ms 2088 KB Output is correct
7 Correct 28 ms 4692 KB Output is correct
8 Correct 23 ms 3536 KB Output is correct
9 Correct 31 ms 5628 KB Output is correct
10 Correct 2 ms 2088 KB Output is correct
11 Correct 8 ms 2088 KB Output is correct
12 Correct 13 ms 2688 KB Output is correct
13 Correct 10 ms 2400 KB Output is correct
14 Correct 38 ms 6560 KB Output is correct
15 Correct 5 ms 2088 KB Output is correct