-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBefore an Exam.cpp
50 lines (49 loc) · 1.1 KB
/
Before an Exam.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll i,j,n,time;
ll a[35],b[35];
while(cin>>n>>time)
{
ll min_time=0,max_time=0,sum_time=0;
vector<ll>v;
for(i=0; i<n; i++)
{
cin>>a[i]>>b[i];
min_time+=a[i];
max_time+=b[i];
v.push_back(a[i]);
sum_time+=a[i];
}
if(min_time<=time && time<=max_time)
{
cout<<"YES\n";
if(sum_time<time)
{
for(i=0; i<n; i++)
{
ll df=b[i]-a[i];
j=1;
while(j<=df)
{
if(sum_time==time)
break;
sum_time++;
v[i]++;
j++;
}
}
}
for(i=0; i<v.size(); i++)
{
cout<<v[i]<<" ";
}
cout<<endl;
}
else
cout<<"NO\n";
}
return 0;
}