Problem | arrayfind |
---|---|
User | wyaptw |
Submission Time | 2025-06-12 13:00:51 |
Score | 0 |
Max Time | N/A |
Max Memory | N/A |
Owl Get a Life
arrayfind.cpp: In function ‘int main()’:
arrayfind.cpp:4:88: error: request for member ‘sort’ in ‘num’, which is of non-class type ‘int [l]’
4 | int main(){int l,q;std::cin >> l;int num[l];for(int i = 0;i<l;++i)std::cin>>num[i];num.sort();std::cin >> q;int ask[q],low,high,depth;for(int i=0;i<q;++i)std::cin>>ask[i];for(int i=0;i<q;++i){depth=1;low=0;high=0;if(ask[i]<num[0])high=l;else if(ask[i]>num[l-1])low=l;else{int j=0;while(num[j]<=ask[i]){if(num[j]<ask[i])low++;j++;}high=l-j;}std::cout<<"Smaller: "<<low<<","<<"Greater: "<<high<<"\n";}return 0;}
| ^~~~