QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#697277#6531. Base Station Constructionenze114514Compile Error//C++201.1kb2024-11-01 12:39:052024-11-01 12:39:08

Judging History

你现在查看的是最新测评结果

  • [2024-11-01 12:39:08]
  • 评测
  • [2024-11-01 12:39:05]
  • 提交

answer


    int n;
    cin >> n;

    int a[n + 1], r[n + 1];
    ll f[n + 1];

    for(int i = 1; i <= n; i++){
        cin >> a[i];
        f[i] = INF;
        r[i] = 0;
    }

    int m;
    cin >> m;

    vector<vector<int>> b;
    for(int i = 0; i < m; i++){
        int l, r;
        cin >> l >> r;
        b.pb({l, r});
    }

    sort(b.begin(), b.end(), cmp);
    for(int i = 0, j = 0, k = 0; i <= n; i++){
        while(j < m && b[j][1] < i){
            k = b[j][0];
            j++;
        }
        r[i] = k;
    }

    f[0] = 0;
    deque<int> q;
    q.push_back(0);

    for(int i = 1; i <= n; i++){
        while(!q.empty() && q.front() < r[i]){
            q.pop_front();
        }
        if(!q.empty()){
            f[i] = chmin(f[i], f[q.front()] + a[i]);
        }

        while(!q.empty() && f[q.back()] >= f[i]){
            q.pop_back();
        }
        q.push_back(i);
    }

    ll qwq = INF;
    for(int i = b[m - 1][0]; i <= b[m - 1][1]; i++){
        qwq = chmin(qwq, f[i]);
    }
    cout << qwq << endl;

詳細信息

answer.code:3:5: error: ‘cin’ does not name a type
    3 |     cin >> n;
      |     ^~~
answer.code:5:13: error: size of array ‘a’ is not an integral constant-expression
    5 |     int a[n + 1], r[n + 1];
      |           ~~^~~
answer.code:5:23: error: size of array ‘r’ is not an integral constant-expression
    5 |     int a[n + 1], r[n + 1];
      |                     ~~^~~
answer.code:6:5: error: ‘ll’ does not name a type
    6 |     ll f[n + 1];
      |     ^~
answer.code:8:5: error: expected unqualified-id before ‘for’
    8 |     for(int i = 1; i <= n; i++){
      |     ^~~
answer.code:8:20: error: ‘i’ does not name a type
    8 |     for(int i = 1; i <= n; i++){
      |                    ^
answer.code:8:28: error: ‘i’ does not name a type
    8 |     for(int i = 1; i <= n; i++){
      |                            ^
answer.code:15:5: error: ‘cin’ does not name a type
   15 |     cin >> m;
      |     ^~~
answer.code:17:12: error: ‘vector’ was not declared in this scope
   17 |     vector<vector<int>> b;
      |            ^~~~~~
answer.code:17:12: error: ‘vector’ was not declared in this scope
answer.code:17:12: error: ‘vector’ was not declared in this scope
answer.code:17:12: error: ‘vector’ was not declared in this scope
answer.code:17:12: error: ‘vector’ was not declared in this scope
answer.code:17:12: error: ‘vector’ was not declared in this scope
answer.code:17:12: error: ‘vector’ was not declared in this scope
answer.code:17:12: error: ‘vector’ was not declared in this scope
answer.code:17:12: error: ‘vector’ was not declared in this scope
answer.code:17:5: error: ‘vector’ does not name a type
   17 |     vector<vector<int>> b;
      |     ^~~~~~
answer.code:18:5: error: expected unqualified-id before ‘for’
   18 |     for(int i = 0; i < m; i++){
      |     ^~~
answer.code:18:20: error: ‘i’ does not name a type
   18 |     for(int i = 0; i < m; i++){
      |                    ^
answer.code:18:27: error: ‘i’ does not name a type
   18 |     for(int i = 0; i < m; i++){
      |                           ^
answer.code:24:9: error: expected constructor, destructor, or type conversion before ‘(’ token
   24 |     sort(b.begin(), b.end(), cmp);
      |         ^
answer.code:25:5: error: expected unqualified-id before ‘for’
   25 |     for(int i = 0, j = 0, k = 0; i <= n; i++){
      |     ^~~
answer.code:25:34: error: ‘i’ does not name a type
   25 |     for(int i = 0, j = 0, k = 0; i <= n; i++){
      |                                  ^
answer.code:25:42: error: ‘i’ does not name a type
   25 |     for(int i = 0, j = 0, k = 0; i <= n; i++){
      |                                          ^
answer.code:33:5: error: ‘f’ does not name a type
   33 |     f[0] = 0;
      |     ^
answer.code:34:5: error: ‘deque’ does not name a type
   34 |     deque<int> q;
      |     ^~~~~
answer.code:35:5: error: ‘q’ does not name a type
   35 |     q.push_back(0);
      |     ^
answer.code:37:5: error: expected unqualified-id before ‘for’
   37 |     for(int i = 1; i <= n; i++){
      |     ^~~
answer.code:37:20: error: ‘i’ does not name a type
   37 |     for(int i = 1; i <= n; i++){
      |                    ^
answer.code:37:28: error: ‘i’ does not name a type
   37 |     for(int i = 1; i <= n; i++){
      |                            ^
answer.code:51:5: error: ‘ll’ does not name a type
   51 |     ll qwq = INF;
      |     ^~
answer.code:52:5: error: expected unqualified-id before ‘for’
   52 |     for(int i = b[m - 1][0]; i <= b[m - 1][1]; i++){
      |     ^~~
answer.code:52:30: error: ‘i’ does not name a type
   52 |     for(int i = b[m - 1][0]; i <= b[m - 1][1]; i++){
      |                              ^
answer.code:52:48: error: ‘i’ does not name a type
   52 |     for(int i = b[m - 1][0]; i <= b[m - 1][1]; i++){
      |                                                ^
answer.code:55:5: error: ‘cout’ does not name a type
   55 |     cout << qwq << endl;
      |     ^~~~