Submission #147576

# Submission time Handle Problem Language Result Execution time Memory
147576 2019-08-30T07:15:53 Z Ruxandra985 Hindeks (COCI17_hindeks) C++14
50 / 50
118 ms 2296 KB
#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

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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 24 ms 632 KB Output is correct
9 Correct 118 ms 2296 KB Output is correct
10 Correct 57 ms 1400 KB Output is correct