都注释成这样了怎么还会RE。。。

P2249 【深基13.例1】查找

Sparkle_ovo @ 2024-10-16 11:14:30

//#include <stdio.h>
//#include <stdlib.h>
#include<bits/stdc++.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
const int N = 1e5 + 10;
int a[N];
int qread() {
    int f = 1, num = 0;
    char a = getchar();
    while (a < '0' || a > '9') {
        if (a == '-')f = -1;
        a = getchar();
    }
    while ('0' <= a && a <= '9') {
        num *= 10;
        num += a - '0';
        a = getchar();
    }
    return num * f ;
//int a;
//cin>>a;
//return a;
}
int check(int l, int r, int opt) {
    while (l < r) {
        int mid = (l + r) >> 1;
        if (a[mid] < opt) l = mid + 1;
        else if (a[mid] >= opt) r = mid ;
//      else if (a[mid] == opt ){
////            while(a[mid]==a[mid-1]&&mid>1)mid--;
//          return mid;
//      }
    }
    if(a[l]!=opt)
    return -1;
    else return l;
}
int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
//      a[i] = qread();
        cin>>a[i];
    }
    for (int i = 1; i <= m; i++) {
//      int opt = qread();
//int opt;cin>>opt;
//      cout << check(1, n, opt) << " ";
    }
//  getchar();
    return 0;
}

by Misty_Post @ 2024-10-16 11:20:09

@Sparkle_ovo a数组开小啦


by Misty_Post @ 2024-10-16 11:21:38

@Sparkle_ovo 改成const int N = 1e6 + 10;


by Sparkle_ovo @ 2024-10-16 11:22:06

@Misty_Post 我傻了QAQ


|