Submission #658435

# Submission time Handle Problem Language Result Execution time Memory
658435 2022-11-13T08:12:56 Z Nhoksocqt1 Baloni (COCI15_baloni) C++17
0 / 100
55 ms 3916 KB
#include<bits/stdc++.h>
using namespace std;

#define inf 0x3f3f3f3f
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define fi first
#define se second
#define N 1000006
typedef long long ll;
typedef pair<int, int> ii;

template<class X, class Y>
	inline bool maximize(X &x, const Y &y) {return (x < y ? x = y, 1 : 0);}
template<class X, class Y>
	inline bool minimize(X &x, const Y &y) {return (x > y ? x = y, 1 : 0);}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Random(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

int readInt() {
	bool minus = false;
	int result = 0;
	char ch;
	ch = getchar();
	while(true) {
		if(ch == '-') break;
		if(ch >= '0' && ch <= '9') break;
		ch = getchar();
	}

	if(ch == '-') minus = true; else result = ch - '0';
	while(true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result * 10 + (ch - '0');
	}

	if(minus)
		return -result;
	else
		return result;
}

int last[N], numBalloon;

void process() {
    cin >> numBalloon;

    int res(0);
    for (int i = 1; i <= numBalloon; ++i) {
        int height;
        cin >> height;
        if(!last[height + 1]) {
            ++res;
        }

        last[height] = i;
        last[height + 1] = 0;
    }

    cout << res;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//    freopen("baloni.inp", "r", stdin);
//    freopen("baloni.out", "w", stdout);

    process();
    return 0;
}

Compilation message

baloni.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    6 | #pragma GCC optimization ("O3")
      | 
baloni.cpp:7: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    7 | #pragma GCC optimization ("unroll-loops")
      |
# 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 1 ms 340 KB Output isn't correct
5 Incorrect 53 ms 3916 KB Output isn't correct
6 Incorrect 53 ms 3788 KB Output isn't correct
7 Incorrect 55 ms 3124 KB Output isn't correct
8 Incorrect 43 ms 3120 KB Output isn't correct
9 Incorrect 53 ms 3512 KB Output isn't correct
10 Incorrect 47 ms 3376 KB Output isn't correct