编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#2912 #1004. 提瓦特大冒险 Compile Error 0 0 ms 0 K C++ 17 / 440 B crazyMouse 2023-11-22 16:43:52
显示原始代码
#include <iostream>
using namespace std;
#define MAXN 100010

int N, M, T;
int A[MAXN], Y[MAXN];
bool X[MAXN];
int main() {
    cin >> N >> M >> T;
    for (int i = 1; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 1; i <= M; i++) {
        int temp, t;
        cin >> temp;
        X[temp]++;
        cin >> t;
        Y[temp] = t;
    }
    for (int i = 1; i < N; i++) {
        if (T <= 0) {
            cout << "No";
            return 0;
        }
        if (X[i])
            T += Y[i];
        T -= A[i];
    }
    cout << "Yes";
}

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:15:9: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   15 |   X[temp]++;
      |   ~~~~~~^