编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#80247 | #1021. jwp的区间游戏 | Compile Error | 0 | 0 ms | 0 K | C++ 17 / 552 B | BenChak | 2022-07-16 18:04:37 |
#include <stdio.h>
#include <algorithm>
using namespace std;
struct map {
long long int no, go;
} a[1000005];
bool s[1000005];
long long int n, ans, p = -1, h;
bool cmp(map a, map b) { return a.go < b.go; }
int main() {
scanf("%lld", &n);
for (int i = 1; i <= n; ++i) {
scanf("%lld%lld", &a[i].no, &a[i].go);
}
sort(a + 1, a + n + 1, cmp);
for (int i = 1; i <= n; ++i) {
if (p <= a[i].no && a[i].end == 0) {
for (int j = 1; j <= n; ++j) {
if (s == 0 && a[i].go >= a[j].no)
s = 1;
}
p = a[i].go;
++ans;
}
}
printf("%lld", ans);
return 0;
}
编译信息
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:23:23: error: 'struct map' has no member named 'end'
23 | if(p<=a[i].no&&a[i].end==0)
| ^~~
/sandbox/1/a.cpp:28:6: error: incompatible types in assignment of 'int' to 'bool [1000005]'
28 | s=1;
| ~^~
/sandbox/1/a.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
15 | scanf("%lld",&n);
| ~~~~~^~~~~~~~~~~
/sandbox/1/a.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
18 | scanf("%lld%lld",&a[i].no,&a[i].go);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~