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?
| № | Пользователь | Рейтинг |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3408 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| Страны | Города | Организации | Всё → |
| № | Пользователь | Вклад |
|---|---|---|
| 1 | Qingyu | 154 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 146 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 135 |
| 9 | maroonrk | 133 |
| 10 | cry | 130 |
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?
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;
}
| Название |
|---|


