我为啥编译失败呢?
查看原帖
我为啥编译失败呢?
348644
kevin_max楼主2021/3/13 20:38
#include <bits/stdc++.h>
using namespace std;

const int b772=250010;
long long k[b772],h[b772];
long long zhan[b772];
int main(){
    int n,ans,top=0;
    scanf("%d",&n);
    ans=n;
    for(int i=1; i<=n; i++){
        scanf("%lld%lld",&k[i],&h[i]);
        while(top&&h[zhan[top]]>h[i]){
            top--;
            if(h[zhan[top]]==h[i]){
                ans--;
            }
        }
        zhan[++top]=i;
    }
    cout<<ans<<endl;
    return 0;
}

附上我的代码。

2021/3/13 20:38
加载中...