답안 #361696

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
361696 2021-01-31T09:26:42 Z daringtrifles 지구 온난화 (NOI13_gw) C++17
40 / 40
250 ms 8812 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll int
#define pll pair<ll, ll>
#define FOR(i, a, b) for (signed ll i = (signed ll)(a); i < (signed ll)(b); i++)
#define NEGFOR(i, a, b) for (ll i = (a); i > (b); i--)
#define vll vector<ll>
#define sll set<ll>
#define ld long double
#define inf 10000000000
#define mll multiset<ll>
#define vpll vector<pll>
#define nn << "\n"
#define ss << " "
//10^8 operations per second
//greatest int is 2,147,483,647
//greates long long is 9.22337204e18

//ALL FUNCTIONS SHOULD BE LL!!!!
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n; cin>>n;

    vpll v(n);

    FOR(i,0,n){
        cin>>v[i].first; v[i].second=i+1;
    }
    sort(v.rbegin(),v.rend());
    vector<bool> risen(n+5,false);
    ll curr=0,ans=1;
    FOR(i,0,n){
        curr++;
        risen[v[i].second]=1;
        if (risen[v[i].second-1]){
             --curr;
        }
        if (risen[v[i].second+1]){
            --curr;
        }
        if (i+1<n&&v[i+1].first==v[i].first) continue;
        ans=max(ans,curr);
    }
    cout<<ans;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 1132 KB Output is correct
2 Correct 20 ms 1132 KB Output is correct
3 Correct 19 ms 1132 KB Output is correct
4 Correct 19 ms 1132 KB Output is correct
5 Correct 21 ms 1132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 1132 KB Output is correct
2 Correct 83 ms 1132 KB Output is correct
3 Correct 21 ms 1132 KB Output is correct
4 Correct 88 ms 1260 KB Output is correct
5 Correct 21 ms 1388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 232 ms 8724 KB Output is correct
2 Correct 237 ms 8684 KB Output is correct
3 Correct 229 ms 8684 KB Output is correct
4 Correct 232 ms 8556 KB Output is correct
5 Correct 226 ms 8684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 250 ms 8812 KB Output is correct
2 Correct 235 ms 8480 KB Output is correct
3 Correct 234 ms 8684 KB Output is correct
4 Correct 204 ms 8556 KB Output is correct
5 Correct 204 ms 8684 KB Output is correct