| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 74102 | 董承诺 | 二分查找 | C++ | Wrong Answer | 11 | 4 MS | 300 KB | 329 | 2023-05-20 16:31:31 |
#include<bits/stdc++.h> using namespace std; int a,b[100010],c,l=1,r,m; int main(){ cin>>a; r=a; for(int i=1;i<=a;i++) cin>>b[i]; cin>>c; while(l<=r){ if(l>=r&&b[r]==c){ cout<<r; break; } else{ cout<<"-1"; break; } m=(l+r)/2; if(c<=b[m]) r=m; if(c>b[m]) l=m+1; } return 0; }