답안 #537147

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
537147 2022-03-14T16:04:01 Z Xiaoyang 지구 온난화 (NOI13_gw) C++17
30 / 40
262 ms 33248 KB
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define endl "\n"
#define pb push_back
#define MP make_pair
#define ll long long
#define int long long
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define pq priority_queue
#define gcd(x,y) __gcd( x, y)
#define ALL(x) x.begin(),x.end()
#define pll pair<long long,long long>
#define debug(x) cerr<<#x<<"="<<x<<endl
#define rep(i,a,b) for (int i=a;i<(int)(b);i++)
typedef tree<long long, null_type, less_equal<long long>,rb_tree_tag, tree_order_statistics_node_update>ordered_set;
int lowbit(int x){return x&(-x);}
long long expo(ll x,ll y,ll z){if(y==1)return (long long)x;ll m=expo(x,y/2,z)%z;if(y%2==0)return (long long)((m*m)%z);else return (long long)((((m*m)%z)*x)%z);}
int fw[1000005];void update(int x,int c){while(x<=1000005){fw[x]=fw[x]+c;x+=lowbit(x);}}int query(int x){int ans=0;while(x>=1){ans+=fw[x];x-=lowbit(x);}return ans;}

int blist[1000009];
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,x=0,ans=0;cin>>n;
	vector<pii>alist;
	rep(i,0,n){
		int a;cin>>a;
		alist.pb({a,i});
	}
	sort(ALL(alist));
    reverse(ALL(alist));
	rep(i,0,n){
		blist[alist[i].se]=1;
		if(alist[i].se>0)x-=blist[alist[i].se-1];
		if(alist[i].se<n-1)x-=blist[alist[i].second+1];
      	x++;
		if(i!=n-1 and alist[i].fi>alist[i+1].fi)ans=max(ans, x);
	}
	cout<<ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 2804 KB Output is correct
2 Correct 25 ms 3092 KB Output is correct
3 Correct 19 ms 3064 KB Output is correct
4 Correct 20 ms 3020 KB Output is correct
5 Correct 19 ms 3012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 2812 KB Output is correct
2 Correct 18 ms 3400 KB Output is correct
3 Correct 23 ms 3644 KB Output is correct
4 Correct 22 ms 3556 KB Output is correct
5 Correct 20 ms 3556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 217 ms 23916 KB Output is correct
2 Runtime error 228 ms 33248 KB Memory limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 225 ms 23960 KB Output is correct
2 Correct 222 ms 32620 KB Output is correct
3 Correct 262 ms 32620 KB Output is correct
4 Correct 214 ms 26892 KB Output is correct
5 Correct 213 ms 26684 KB Output is correct