rohansumant's blog

By rohansumant, history, 6 years ago, In English

Hello Codeforces,

Whenever I click on any user profile, I see that that user has quite a bunch of friends. How do you guys know each other? How do you make friends?

Full text and comments »

  • Vote: I like it
  • +38
  • Vote: I do not like it

By rohansumant, history, 8 years ago, In English

Consider the following test case

10 3
0 3 0 1 0 0 0 0 2 0
1 1 4

The following AC submission gives the answer as 9. I would like to know how is the answer 9 correct. Since subject 3 requires 4 days of preparation, which clearly isn't possible, shouldn't the answer be -1 ?

#include<bits/stdc++.h>  
using namespace std;  
int main()  
{  
int n,m;  
cin>>n>>m;  
int arr[n+1];  
for(int i=1;i<=n;i++)cin>>arr[i];  
int sum=m,x;  
for(int i=0;i<m;i++){cin>>x; sum+=x;}  
  
for(int i=sum;i<=n;i++)if(arr[i]){cout<<i; return 0;}  
cout<<-1;  
}

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it