编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#68694 | #1004. D. 成立西安“全天候”量化科技有限公司 | Compile Error | 0 | 0 ms | 0 K | C++ / 949 B | 该起什么名字 | 2022-04-05 1:46:34 |
// copy from IDK
#include <bits/stdc++.h>
using namespace std;
struct STAR {
int x, y;
int z;
} star[100005];
int flag[100005];
bool cmp(STAR a, STAR b) {
if (a.x != b.x)
return a.x > b.x;
else
return a.y > b.y;
}
void test(int n) {
for (int i = 0; i < n; i++) {
cout << star[i].x << " " << star[i].y << " " << star[i].z << endl;
}
}
int main() {
std::ios::sync_with_stdio(false);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
int m = 0;
for (int i = 0; i < n; i++) {
cin >> star[i].x >> star[i].y >> star[i].z;
if (star[i].z)
m++;
}
sort(star, star + n, cmp);
memset(flag, 0, sizeof(flag));
// cout<<endl<<m<<endl;
// test(n);
int ans = 0;
// copycopycopy
set<int> st;
for (int i = 0; i < n; i++) {
if (star[i].z == 1) {
st.insert(star[i].y);
} else {
auto p = st.upper_bound(star[i].y);
if (p != st.end()) {
ans++;
st.erase(p);
}
}
}
cout << ans << endl;
}
return 0;
}
编译信息
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:41:10: error: 'p' does not name a type
41 | auto p = st.upper_bound(star[i].y);
| ^
/sandbox/1/a.cpp:42:9: error: 'p' was not declared in this scope
42 | if (p != st.end()) {
| ^