-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCCspammerMoreEfficient.cpp
More file actions
59 lines (56 loc) · 1.02 KB
/
CCspammerMoreEfficient.cpp
File metadata and controls
59 lines (56 loc) · 1.02 KB
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
50
51
52
53
54
55
56
57
58
59
#include <iostream>
using namespace std;
int main() {
int T;
cin>>T;
while(T-- > 0)
{
long N , minX , maxX;
cin>>N>>minX>>maxX;
int w_i[N],b_i[N];
int spammers = 0, notspammers=0;
for (int i=0; i<N; i++)
{
cin>>w_i[i];
cin>>b_i[i];
}
int even = 2 , odd = 1;
for(int neuron = 0; neuron<N; neuron++)
{
even = w_i[neuron]*even + b_i[neuron];
odd = w_i[neuron]*odd + b_i[neuron];
}
if (even%2 == 0)
{
if(odd%2 == 0)
{
cout<<maxX - minX + 1<<" "<<0<<endl;
}
else
{
notspammers = (maxX - minX)/2;
if (minX % 2 == 0)
{
notspammers++;
}
cout<<notspammers<<" "<<maxX - minX + 1 -notspammers<<endl;
}
}
else
{
if(odd%2==0)
{
spammers=(maxX-minX+1)/2;
if(minX%2==0)
spammers++;
notspammers = maxX-minX+1-spammers;
cout<<notspammers<<" "<<spammers<<"\n";
}
else
{
cout<<0<<" "<<maxX-minX+1<<"\n";
}
}
}
return 0;
}