Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
141782 | 刘嘉乐 | 音乐会 | C++ | 解答错误 | 0 | 86 MS | 2160 KB | 336 | 2024-04-06 11:05:28 |
#include<bits/stdc++.h> using namespace std; int a[500005],tot; int ai; int main(){ int n; cin>>n; int sum = 0,t = 0x3f3f3f3f; for(int i=1;i<=n;i++){ int x; cin>>x; while(tot>0&&a[tot]<x){ sum++; tot--; } sum+=ai; a[++tot] = x; if(x==t)ai++; else ai = 1; } cout<<sum<<'\n'; return 0; }