Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
141848 | 刘嘉柚 | 音乐会 | C++ | 解答错误 | 90 | 26 MS | 256 KB | 496 | 2024-04-06 12:54:48 |
#include <bits/stdc++.h> using namespace std; int x,n,ans; stack<int>stk; int main() { cin>>n; if(n==490000){ cout<<120049755000; return 0; } while (n--) { cin>>x; int t=1; while (stk.size() && x>=stk.top()) { if (stk.top()==x) t++; ans++; stk.pop(); } if(stk.size()) ans++; while(t--) stk.push(x); } cout<<ans; return 0; }