-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path665.cpp
More file actions
55 lines (53 loc) · 989 Bytes
/
Copy path665.cpp
File metadata and controls
55 lines (53 loc) · 989 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
55
#include <iostream>
#include <vector>
#include <array>
using namespace std;
int main(){
int t, n, k, var, s;
char op;
scanf("%d", &t);
while(t--){
cout << "Caso " << t << endl << endl;
array<int, 110>a;
a.fill(0);
scanf("%d %d", &n, &k);
for(int j=0; j<k; j++){
vector<int>left, right;
scanf("%d", &s);
for(int i=0; i<s; i++){
scanf("%d", &var);
left.push_back(var);
}
for(int i=0; i<s; i++){
scanf("%d", &var);
right.push_back(var);
}
scanf("%c\n", &op);
if(op=='='){
for(int i=0; i<s; i++){
a[left[i]] = 0;
a[right[i]] = 0;
}
}
else if(op=='<'){
for(unsigned int i=0; i<right.size(); i++)
a[right[i]]++;
}
else{
for(unsigned int i=0; i<left.size(); i++)
a[left[i]]++;
}
int res=0, num=0;
for(int i=0; i<n; i++){
cout << "a[" << i << "] = " << a[i] << endl;
if(a[i]>res){
res = i;
num = 0;
}
else if(a[i]==res)
num++;
}
}
}
return 0;
}