Advertisement
rotti321

SubIIIEx4 2017

May 19th, 2021
1,041
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int k,n,m,x,y,p,q;
  7.     cin>>n;
  8.     cin>>m;
  9.     cin>>x;
  10.     for(int i=1;i<=n-1;i++){
  11.         cin>>y;
  12.     }
  13.     cin>>p;
  14.     k=1;
  15.     if(p>y){
  16.         cout<<"imposibil";
  17.         return 0;
  18.     }
  19.     while(cin>>q){
  20.         k++;
  21.         if(p<x && y<q){
  22.             cout<<k;
  23.             return 0;
  24.         }
  25.         p=q;
  26.     }
  27.     cout<<"imposibil";
  28.  return 0;  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement