Source Code
#include <iostream>
using namespace std;
int main() {
  int n,s;
  int c=0;
  cin>>n>>s;
  int t[n],r[n];
  for(int i=0;i<n;i++){
    cin>>t[i];
  }
  for(int i =0;i<n;i++){
    cin>>r[i];
  }
  for(int i=0;i<n;i++){
    s-=t[i];
    s+=r[i];
    c++;
    if(s<=0){
      break;
    }
  }
  cout<<c;
}
Copy
Wheatly's portals - Easy version Hadeel
GNU G++17
2 ms
472 KB
Wrong Answer