Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
142410 | 谢思涵 | 音乐会 | C++ | 运行超时 | 90 | 1986 MS | 364 KB | 463 | 2024-04-07 21:41:12 |
#include<iostream> #include<stack> using namespace std; stack <int> s; int main() { int x, n, ans = 0; cin >> n; for(int i = 1; i <= n; i++) { cin >> x; int t = 1; while(s.size() && x >= s.top()) { if (s.top() == x) t++; ans++; s.pop(); } if(s.size()) ans++; for(int j = 1; j <= t; j++) s.push(x); } cout << ans << endl; return 0; }