forked from Mansi109/Competitive-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind the fine.cpp
More file actions
54 lines (50 loc) · 788 Bytes
/
find the fine.cpp
File metadata and controls
54 lines (50 loc) · 788 Bytes
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
#include <bits/stdc++.h>
using namespace std;
int main() {
//code
int t;
cin>>t;
while(t--)
{
int n,date;
cin>>n>>date;
vector<int> p;
vector<int> c;
int i,j,x,y;
for(i=0;i<n;i++)
{
cin>>x;
c.push_back(x);
}
for(i=0;i<n;i++)
{
cin>>y;
p.push_back(y);
}
int fine=0;
if(date%2==0)
{
for(int j=0;j<n;j++)
{
if(c[j]%2!=0)
{
fine+=p[j];
}
}
cout<<fine<<" ";
}
else
{
for(int j=0;j<n;j++)
{
if(c[j]%2==0)
{
fine+=p[j];
}
}
cout<<fine<<" ";
}
cout<<endl;
}
return 0;
}