-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtidrice.c
31 lines (29 loc) · 810 Bytes
/
tidrice.c
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
#include "iostream.h"
#include<string.h>
typedef std::map<std::string, int> name_vote_t;
typedef std::map<std::string, int>::iterator name_vote_it_t;
int main()
{
long long int t,n,vote;
char names[101][21];
scanf("%lld",&t);
while(t--)
{
scanf("%lld\n",&n);
name_vote_t names;
const char name_temp;
int vote=0, vote_i=0;
for(i=0;i<n;i++)
{
scanf("%s %d",name_temp,vote);
if(vote==53) vote_i=1;
else if(vote==55) vote_i=-1;
name_vote_it_t name_vote_it = names.find(name_temp);
if( name_vote_it == names.end() ){
names.insert(name::value_type(name_temp, vote_i) );
}
else
name_vote_it.second = vote_i;
}
}
}