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