Submission #709010

# Submission time Handle Problem Language Result Execution time Memory
709010 2023-03-13T03:59:51 Z vjudge1 Baloni (COCI15_baloni) C++17
0 / 100
187 ms 7392 KB
#include <bits/stdc++.h>
using namespace std;

// #pragma comment(linker, "/stack:2000000000")
// #pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")


typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;

#define precise(a) cout<<fixed<<setprecision(a)
#define sz size()
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
// t1
const ll mod = ll(1e9)+7; //(b + (a%b)) % b (to mod -1%(10^9+7) correctly in c++ its -1 but its suppose to be 10^9+6
const ll MOD = 998244353;  // (a%mod)*(binpow(b,mod-2,mod) = (a/b)%mod
const ll N = ll(1e6)+10;
const ll K = 17;
const ll inf = 4e18;
const ld eps = 1e-15L;
// const ll B = 316;
// const ld pie = acos(-1.0);

ll lcm(ll a, ll b){ return (a / __gcd(a,b))*b; }
ll binpow(ll a, ll b, ll m){ ll res=1;a%=m; while(b>0){ if(b&1)res=(res*a)%m; a=(a*a)%m; b/=2; } return res%m;}

void Freopen(string Key){ freopen((Key+".in").c_str(), "r", stdin); freopen((Key+".out").c_str(), "w", stdout); }

void precalc() {

}


void Baizho()
{  
	ll n; cin>>n;
	ll a[n+11];
	for(ll i=1; i<=n; i++) cin>>a[i];
	ll ans = 0;
	map<ll, bool> got;
	for(ll i=1; i<=n; i++) {
		if(!got[a[i]+1]) ans++;
		else got[a[i]+1] = 0;
		got[a[i]] = 1;
	}
	cout<<ans;

}


int main() {

    // Freopen("div7");
    ios_base::sync_with_stdio(false);   
    cin.tie(0);cout.tie(0); 
    precalc();


    int ttt = 1;
    // cin>>ttt;

    for(int i=1; i<=ttt; i++) {Baizho(); }
}

Compilation message

baloni.cpp: In function 'void Freopen(std::string)':
baloni.cpp:34:34: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 | void Freopen(string Key){ freopen((Key+".in").c_str(), "r", stdin); freopen((Key+".out").c_str(), "w", stdout); }
      |                           ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
baloni.cpp:34:76: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 | void Freopen(string Key){ freopen((Key+".in").c_str(), "r", stdin); freopen((Key+".out").c_str(), "w", stdout); }
      |                                                                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Incorrect 2 ms 340 KB Output isn't correct
5 Incorrect 187 ms 6684 KB Output isn't correct
6 Incorrect 187 ms 7392 KB Output isn't correct
7 Incorrect 140 ms 6224 KB Output isn't correct
8 Incorrect 133 ms 6092 KB Output isn't correct
9 Incorrect 168 ms 6536 KB Output isn't correct
10 Incorrect 165 ms 6652 KB Output isn't correct