Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
141807 | 周震东 | 音乐会 | C++ | 运行超时 | 90 | 2023 MS | 480 KB | 385 | 2024-04-06 11:26:27 |
#include <bits/stdc++.h> using namespace std; long long x , n , ans; stack <long long> s; int main() { cin >> n; while (n--) { cin >> x; long long t = 1; while (s.size() && x >= s.top()) { if (s.top() == x) { t++; } ans++; s.pop(); } if (s.size()) { ans++; } while(t--) { s.push(x); } } cout << ans; return 0; }