QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#125311#6343. Bitaro's travelpiokemonCompile Error//C++14899b2023-07-16 15:27:112023-07-16 15:27:14

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-16 15:27:14]
  • 评测
  • [2023-07-16 15:27:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

constexpr int N = 2e5;
int a[N+9];
int maksr[N+9][25];
int maksl[N+9][25];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,q,b;
    cin >> n;
    for (int x=1;x<=n;x++){
        cin >> a[x];
        maksl[x][0] = a[x];
        maskr[x][0] = a[x];
    }
    a[0] = -2e9;
    a[1] = 2e9;
    for (int k=1;k<19;k++){
        maksr[x][k] = max(maksr[x][k-1],maksr[min(n,x+(1<<k)-1)][k-1]);
        maksl[x][k] = max(maksl[x][k-1],maksl[min(n,x-(1<<k)+1)][k-1]);
    }
    cin >> q;
    while(q--){
        cin >> b;
        int pocz,kon,srod;
        pocz = 1;
        kon = n;
        while(pocz<kon){
            srod = (pocz+kon)/2;
            if (a[srod]<=b) pocz = srod;
            else kon = srod-1;
        }
        
    }
    return 0;
}

详细

answer.code: In function ‘int main()’:
answer.code:19:9: error: ‘maskr’ was not declared in this scope; did you mean ‘maksr’?
   19 |         maskr[x][0] = a[x];
      |         ^~~~~
      |         maksr
answer.code:24:15: error: ‘x’ was not declared in this scope
   24 |         maksr[x][k] = max(maksr[x][k-1],maksr[min(n,x+(1<<k)-1)][k-1]);
      |               ^