-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1245.cpp
More file actions
36 lines (33 loc) · 837 Bytes
/
1245.cpp
File metadata and controls
36 lines (33 loc) · 837 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
//botas perdidas
#include <iostream>
#include <vector>
using namespace std;
int main(){
int num_teste;
int numero;
char lado;
int aux=0;
vector<char> direita;
vector<char> esquerda;
while(cin >> num_teste){
for(int i=0; i<num_teste; i++){
cin >> numero >> lado;
if(lado == 'D') direita.push_back(numero);
else esquerda.push_back(numero);
}
for(int j=0; j<direita.size(); j++){
for(int l=0; l<esquerda.size(); l++){
if(esquerda[l] == direita[j]){
aux++;
esquerda.erase(esquerda.begin() + l);
break;
}
}
}
cout << aux << endl;
aux = 0;
direita.clear();
esquerda.clear();
}
return 0;
}