Submission #153854

# Submission time Handle Problem Language Result Execution time Memory
153854 2019-09-17T05:03:51 Z Ruxandra985 Baloni (COCI15_baloni) C++14
100 / 100
105 ms 1784 KB
#include <cstdio>
#include <algorithm>
#include <deque>
using namespace std;
int f[1000010];
int main()
{
    FILE *fin = stdin;
    FILE *fout = stdout;
    int n,i,x;
    int sol = 0;
    fscanf (fin,"%d",&n);
    for (i=1;i<=n;i++){
        fscanf(fin,"%d",&x);
        if (!f[x+1])
            sol++;
        else f[x+1]--;
        f[x]++;
    }
    fprintf (fout,"%d",sol);
    return 0;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:12:12: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     fscanf (fin,"%d",&n);
     ~~~~~~~^~~~~~~~~~~~~
baloni.cpp:14:15: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         fscanf(fin,"%d",&x);
         ~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 103 ms 1656 KB Output is correct
6 Correct 105 ms 1636 KB Output is correct
7 Correct 87 ms 1740 KB Output is correct
8 Correct 84 ms 1656 KB Output is correct
9 Correct 93 ms 1784 KB Output is correct
10 Correct 94 ms 1396 KB Output is correct