Submission #153853

# Submission time Handle Problem Language Result Execution time Memory
153853 2019-09-17T05:02:39 Z Ruxandra985 Baloni (COCI15_baloni) C++14
0 / 100
129 ms 131076 KB
#include <cstdio>
#include <algorithm>
#include <deque>
using namespace std;
deque <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].empty())
            sol++;
        else f[x+1].pop_front();
        f[x].push_back (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 Runtime error 121 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 117 ms 131072 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 119 ms 131072 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 129 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 115 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 116 ms 131072 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 120 ms 131072 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 116 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 115 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 117 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)