[悬赏]样例过但全WA
查看原帖
[悬赏]样例过但全WA
1161278
happy_lion楼主2024/9/26 19:05
#include<bits/stdc++.h>
using namespace std;
struct che{
	int type;
	int time;
	int money;
}a[100010];
struct quan{
	int time;
	int money;
}b[100010];
int be = 1;
int main() {
	int n;
	cin >> n;
	long long c = 0;
	int m = 1;
	for (int i=1;i<=n;i++) {
		int t;
		cin >> t;
		if (t == 0) {
			int q;
			int s;
			cin >> q >> s;
			a[i].type = 0;
			a[i].time = s;
			a[i].money = q;
			b[be].time = s;
			b[be].money = q;
			be++;
			c += q;
		} else if (t == 1) {
			int q;
			int s;
			cin >> q >> s;
			bool flag = true;
			for (int j=m;j<be;j++) {
				if (b[j].time+45 >= s) {
					if (b[j].money >= q) {
						flag = false;
						break;
					}
				} else {
					m = j;
				}
			}
			if (flag) {
				c += q;
			}
		}
	}
	cout << c;
}
2024/9/26 19:05
加载中...