Submission #1030052

# Submission time Handle Problem Language Result Execution time Memory
1030052 2024-07-21T17:41:38 Z jnjwnwnw Global Warming (NOI13_gw) Java 11
Compilation error
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

#define ll long long
#define fff(i, a, b) for(ll i = a; i < b; i++)

#define MAXN 1000006

bool sim[MAXN];
map<ll, ll> cntOf, curCnt;

int main(){
    ll n; cin >> n;
    vector<pair<ll, ll>> v;
    fff(i, 0, n){
        ll a; cin >> a;
        cntOf[a]++;
        v.emplace_back(a, i+1);
    }
    sort(v.rbegin(), v.rend());
    // fff(i, 0, n){
    //     cout << v[i].first << " " << v[i].second << endl;
    // } cout << endl;
    ll best = 0;
    ll cur = 0;
    fff(i, 0, n){
        auto [h, j] = v[i];
        curCnt[h]++;
        sim[j] = 1;
        cur++;
        if (sim[j+1]) cur--;
        if (sim[j-1]) cur--;
        if (curCnt[h] == cntOf[h] && cur > best) best = cur;
    }
    cout << best << endl;
}

Compilation message

gw.java:1: error: illegal character: '#'
#include <iostream>
^
gw.java:1: error: class, interface, or enum expected
#include <iostream>
         ^
gw.java:2: error: illegal character: '#'
#include <algorithm>
^
gw.java:3: error: illegal character: '#'
#include <vector>
^
gw.java:4: error: illegal character: '#'
#include <map>
^
gw.java:8: error: illegal character: '#'
#define ll long long
^
gw.java:8: error: class, interface, or enum expected
#define ll long long
        ^
gw.java:9: error: illegal character: '#'
#define fff(i, a, b) for(ll i = a; i < b; i++)
^
gw.java:9: error: class, interface, or enum expected
#define fff(i, a, b) for(ll i = a; i < b; i++)
                                   ^
gw.java:9: error: class, interface, or enum expected
#define fff(i, a, b) for(ll i = a; i < b; i++)
                                          ^
gw.java:11: error: illegal character: '#'
#define MAXN 1000006
^
gw.java:14: error: class, interface, or enum expected
map<ll, ll> cntOf, curCnt;
^
gw.java:16: error: class, interface, or enum expected
int main(){
^
gw.java:17: error: class, interface, or enum expected
    ll n; cin >> n;
          ^
gw.java:18: error: class, interface, or enum expected
    vector<pair<ll, ll>> v;
    ^
gw.java:19: error: class, interface, or enum expected
    fff(i, 0, n){
    ^
gw.java:20: error: class, interface, or enum expected
        ll a; cin >> a;
              ^
gw.java:21: error: class, interface, or enum expected
        cntOf[a]++;
        ^
gw.java:22: error: class, interface, or enum expected
        v.emplace_back(a, i+1);
        ^
gw.java:23: error: class, interface, or enum expected
    }
    ^
gw.java:28: error: class, interface, or enum expected
    ll best = 0;
    ^
gw.java:29: error: class, interface, or enum expected
    ll cur = 0;
    ^
gw.java:30: error: class, interface, or enum expected
    fff(i, 0, n){
    ^
gw.java:32: error: class, interface, or enum expected
        curCnt[h]++;
        ^
gw.java:33: error: class, interface, or enum expected
        sim[j] = 1;
        ^
gw.java:34: error: class, interface, or enum expected
        cur++;
        ^
gw.java:35: error: class, interface, or enum expected
        if (sim[j+1]) cur--;
        ^
gw.java:36: error: class, interface, or enum expected
        if (sim[j-1]) cur--;
        ^
gw.java:37: error: class, interface, or enum expected
        if (curCnt[h] == cntOf[h] && cur > best) best = cur;
        ^
gw.java:38: error: class, interface, or enum expected
    }
    ^
gw.java:40: error: class, interface, or enum expected
}
^
31 errors