Submission #153850

# Submission time Handle Problem Language Result Execution time Memory
153850 2019-09-17T04:59:12 Z Ruxandra985 Baloni (COCI15_baloni) C++14
0 / 100
103 ms 1400 KB
#include <cstdio>
#include <algorithm>
#include <set>
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]==0)
            sol++;
        f[x] = i;
    }
    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 Incorrect 2 ms 256 KB Output isn't correct
2 Incorrect 3 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 3 ms 256 KB Output isn't correct
5 Incorrect 103 ms 1380 KB Output isn't correct
6 Incorrect 101 ms 1380 KB Output isn't correct
7 Incorrect 82 ms 1400 KB Output isn't correct
8 Incorrect 81 ms 1400 KB Output isn't correct
9 Incorrect 90 ms 1400 KB Output isn't correct
10 Incorrect 90 ms 760 KB Output isn't correct