# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
336326 | 2020-12-15T04:46:04 Z | beepbeepsheep | 지구 온난화 (NOI13_gw) | C++17 | 221 ms | 34132 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long const ll bignum=1e17; const int inf= 2e9; const int mod= 1e9+7; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll ele,n; cin>>n; vector<ll> arr; ll prev=-1; for (ll i=0;i<n;i++){ cin>>ele; if (ele!=prev){ arr.push_back(ele); } prev=ele; } if (arr.size()==1){ cout<<1; return 0; } vector<pair<ll,ll>> v; for (ll i=1;i<arr.size()-1;i++){ if (arr[i]>arr[i-1] && arr[i]>arr[i+1]){ v.push_back(make_pair(arr[i],1)); } if (arr[i]<arr[i-1] && arr[i]<arr[i+1]){ v.push_back(make_pair(arr[i],-1)); } } if (arr[0]>arr[1]) v.push_back(make_pair(arr[0],1)); if (arr[arr.size()-1]>arr[arr.size()-2]) v.push_back(make_pair(arr[arr.size()-1],1)); sort(v.rbegin(),v.rend()); ll ans=0,curr=0; for (ll i=0;i<v.size();i++){ curr+=v[i].second; if (i!=v.size()-1 && v[i+1].first==v[i].first) continue; ans=max(curr,ans); } cout<<ans; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 13 ms | 2664 KB | Output is correct |
2 | Correct | 13 ms | 2664 KB | Output is correct |
3 | Correct | 13 ms | 2664 KB | Output is correct |
4 | Correct | 13 ms | 2664 KB | Output is correct |
5 | Correct | 13 ms | 2664 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 3308 KB | Output is correct |
2 | Correct | 18 ms | 3308 KB | Output is correct |
3 | Correct | 20 ms | 3308 KB | Output is correct |
4 | Correct | 20 ms | 3308 KB | Output is correct |
5 | Correct | 19 ms | 3308 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 214 ms | 24840 KB | Output is correct |
2 | Runtime error | 221 ms | 34132 KB | Memory limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 215 ms | 24788 KB | Output is correct |
2 | Runtime error | 216 ms | 33528 KB | Memory limit exceeded |
3 | Halted | 0 ms | 0 KB | - |