编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#80241 #1021. jwp的区间游戏 Compile Error 0 0 ms 0 K C++ 17 / 578 B BenChak 2022-07-16 17:50:27
显示原始代码
#include <stdio.h>
#include <queue>
#include <algorithm>
using namespace std;
bool flag[1000005];
priority_queue<map> a;
priority_queue<map> b;
long long int n, ans, p = -1, c[1000005], d;
int main() {
    scanf("%lld", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%lld%lld", &c[i], &d);
        a.push(c[i]);
        b.push(d);
    }
    sort(c + 1, c + n + 1);
    for (int i = 1; i <= n; ++i) {
        if (p <= a.top && flag[i] == 0) {
            for (int j = 1; j <= n; ++j) {
                if (flag[j] == 0 && b.top >= c[i])
                    flag[j] = 1;
            }
            p = b.top();
            ans++;
        }
        a.pop();
        b.pop();
    }
    printf("%lld", ans);
    return 0;
}

编译信息

/sandbox/1/a.cpp:6:16: error: 'map' was not declared in this scope
    6 | priority_queue<map> a;
      |                ^~~
/sandbox/1/a.cpp:4:1: note: 'std::map' is defined in header '<map>'; did you forget to '#include <map>'?
    3 | #include<algorithm>
  +++ |+#include <map>
    4 | using namespace std;
/sandbox/1/a.cpp:6:19: error: template argument 1 is invalid
    6 | priority_queue<map> a;
      |                   ^
/sandbox/1/a.cpp:6:19: error: template argument 2 is invalid
/sandbox/1/a.cpp:6:19: error: template argument 3 is invalid
/sandbox/1/a.cpp:7:16: error: 'map' was not declared in this scope
    7 | priority_queue<map> b;
      |                ^~~
/sandbox/1/a.cpp:7:16: note: 'std::map' is defined in header '<map>'; did you forget to '#include <map>'?
/sandbox/1/a.cpp:7:19: error: template argument 1 is invalid
    7 | priority_queue<map> b;
      |                   ^
/sandbox/1/a.cpp:7:19: error: template argument 2 is invalid
/sandbox/1/a.cpp:7:19: error: template argument 3 is invalid
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:15:5: error: request for member 'push' in 'a', which is of non-class type 'int'
   15 |   a.push(c[i]);
      |     ^~~~
/sandbox/1/a.cpp:16:5: error: request for member 'push' in 'b', which is of non-class type 'int'
   16 |   b.push(d);
      |     ^~~~
/sandbox/1/a.cpp:21:11: error: request for member 'top' in 'a', which is of non-class type 'int'
   21 |   if(p<=a.top&&flag[i]==0)
      |           ^~~
/sandbox/1/a.cpp:25:22: error: request for member 'top' in 'b', which is of non-class type 'int'
   25 |     if(flag[j]==0&&b.top>=c[i])
      |                      ^~~
/sandbox/1/a.cpp:28:8: error: request for member 'top' in 'b', which is of non-class type 'int'
   28 |    p=b.top();
      |        ^~~
/sandbox/1/a.cpp:31:5: error: request for member 'pop' in 'a', which is of non-class type 'int'
   31 |   a.pop();
      |     ^~~
/sandbox/1/a.cpp:32:5: error: request for member 'pop' in 'b', which is of non-class type 'int'
   32 |   b.pop();
      |     ^~~
/sandbox/1/a.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
/sandbox/1/a.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%lld%lld",&c[i],&d);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~