Submission #147576

#TimeUsernameProblemLanguageResultExecution timeMemory
147576Ruxandra985Hindeks (COCI17_hindeks)C++14
50 / 50
118 ms2296 KiB
#include <cstdio>
#include <algorithm>
using namespace std;
int v[500010];
int main()
{
    int n,i,h;
    scanf ("%d",&n);
    for (i=1;i<=n;i++)
        scanf ("%d",&v[i]);
    sort ( v + 1, v + n + 1);
    for (h = n ; h ; h --){
        if (v[h] < n - h + 1 )
            break;
    }
    printf ("%d" , n - h);
    return 0;
}

Compilation message (stderr)

hindeks.cpp: In function 'int main()':
hindeks.cpp:8:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d",&n);
     ~~~~~~^~~~~~~~~
hindeks.cpp:10:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf ("%d",&v[i]);
         ~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...