| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 91255 | sh25_zhoumy | 选择客栈(Day 1) | C++ | 通过 | 50 MS | 264 KB | 510 | 2026-06-12 15:22:32 |
#include <iostream> #define maxn 200005 using namespace std; int n,k,p; int color,price; int last[maxn]; int sum[maxn]; int cnt[maxn]; int ans = 0; int now; int main(){ cin >> n >> k >> p; for (int i=1;i<=n;i++){ cin >> color >> price; if (price <= p) now = i; if (now >= last[color]) sum[color] = cnt[color]; last[color] = i; ans += sum[color]; cnt[color]++; } cout << ans << endl; return 0; }