Submission #40703

# Submission time Handle Problem Language Result Execution time Memory
40703 2018-02-06T19:32:58 Z Hassoony Baloni (COCI15_baloni) C++14
0 / 100
321 ms 604 KB
#include <stdio.h>
#include <stdlib.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
const ll inf=(1ll<<61);
const ll mod=1e9+7;
const int MX=1e6+9;
int n,a[MX],ans,x;
set<int>s;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        scanf("%d",&x);
        if(s.find(x)!=s.end()){
            s.erase(s.find(x));
            x--;
            if(x>=1)s.insert(x);
            continue;
        }
        else s.insert(x-1),ans++;
    }
    cout<<ans<<endl;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:15:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
                       ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Incorrect 2 ms 352 KB Output isn't correct
3 Incorrect 3 ms 404 KB Output isn't correct
4 Incorrect 3 ms 476 KB Output isn't correct
5 Incorrect 321 ms 604 KB Output isn't correct
6 Incorrect 312 ms 604 KB Output isn't correct
7 Incorrect 250 ms 604 KB Output isn't correct
8 Incorrect 256 ms 604 KB Output isn't correct
9 Incorrect 286 ms 604 KB Output isn't correct
10 Incorrect 280 ms 604 KB Output isn't correct