You are viewing a single comment's thread. Return to all comments →
I Dont know why everyone is confusing, the most simplest answer..
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n ; cin >> n; vectornums(n); for(int i = 0;i> nums[i]; }
int q; cin >> q; while(q--) { int target; cin >> target; auto it = lower_bound(nums.begin(),nums.end(),target); if(*it == target) { cout << "Yes " << it-nums.begin()+1 << endl; } else { cout << "No " << it-nums.begin()+1<<endl; } } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Lower Bound-STL
You are viewing a single comment's thread. Return to all comments →
I Dont know why everyone is confusing, the most simplest answer..
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n ; cin >> n; vectornums(n); for(int i = 0;i> nums[i]; }
}