답안 #1086066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1086066 2024-09-09T12:51:57 Z TgX_2 Baloni (COCI15_baloni) C++14
0 / 100
62 ms 40164 KB
/*-----------------------------
        Author : TgX.2
       11Ti - K28 - CHV
-----------------------------*/

#include <bits/stdc++.h>

#define FOR(i, a, b)       for (int i = (a), _b = (b); i <= _b; i += 1)
#define FORD(i, a, b)      for (int i = (a), _b = (b); i >= _b; i -= 1)
#define FORC(i, a, b, c)   for (int i = (a), _b = (b), _c = (c); i <= _b; i += _c)

#define fi                 first
#define se                 second
#define pb                 push_back
#define len(x)             (int)((x).size())
#define all(x)             (x).begin(), (x).end()

#define _                  << " " <<
#define __                 << "\n"

#define ______________TgX______________ main()
#define int                long long
#define intmax             1e9
#define intmin            -1e9
#define llongmax           1e18
#define llongmin          -1e18
#define memo(a, val)       memset((a), (val), sizeof((a)))

using   namespace std;
typedef long long          ll;
typedef pair<int, int>     pii;

template<typename T1, typename T2> 
bool mini(T1 &a, T2 b)
    {if (a > b) a = b; else return 0; return 1;}

template<typename T1, typename T2> 
bool maxi(T1 &a, T2 b)
    {if (a < b) a = b; else return 0; return 1;}
/*-----------------------------*/

const int maxn = 1e6 + 7;
int n, a[maxn];
vector<int> pos[maxn];

void process() {
    cin >> n;
    FOR(i, 1, n) {
        cin >> a[i];
        pos[a[i]].pb(i);
    }

    int ans = n;
    FOR(i, 1, n) {
        if (len(pos[a[i]]) and pos[a[i]].back() == i) pos[a[i]].pop_back();
        if (len(pos[a[i] - 1])) {
            pos[a[i] - 1].pop_back();
            ans--;
        }

    }

    cout << ans;
}



/*-----------------------------*/
______________TgX______________ {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);  
    if (fopen("temp.inp", "r")) {
        freopen("temp.inp", "r", stdin);
        freopen("temp.out", "w", stdout);
    }
    process();
}


/*==============================+
|INPUT                          |
--------------------------------|

================================+
|OUTPUT                         |
--------------------------------|

===============================*/

Compilation message

baloni.cpp:21:41: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   21 | #define ______________TgX______________ main()
      |                                         ^~~~
baloni.cpp:69:1: note: in expansion of macro '______________TgX______________'
   69 | ______________TgX______________ {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
baloni.cpp: In function 'int main()':
baloni.cpp:73:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   73 |         freopen("temp.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
baloni.cpp:74:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |         freopen("temp.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 23900 KB Output isn't correct
2 Incorrect 8 ms 23900 KB Output isn't correct
3 Incorrect 8 ms 24048 KB Output isn't correct
4 Incorrect 8 ms 24064 KB Output isn't correct
5 Incorrect 62 ms 39252 KB Output isn't correct
6 Incorrect 59 ms 39760 KB Output isn't correct
7 Incorrect 47 ms 38992 KB Output isn't correct
8 Incorrect 47 ms 36756 KB Output isn't correct
9 Incorrect 55 ms 40164 KB Output isn't correct
10 Incorrect 52 ms 38736 KB Output isn't correct