-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSorceress.cpp
More file actions
91 lines (82 loc) · 2.09 KB
/
Copy pathSorceress.cpp
File metadata and controls
91 lines (82 loc) · 2.09 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
typedef int long long;
int main()
{
struct Player
{
string name;
vector<char> status;
int ac_count;
int time_p;
};
int com_num;
cin>>com_num;
for(int z=0;z<com_num;z++)
{
int com_pep,com_que;
cin>>com_pep>>com_que;
Player men[com_pep];
for(int i=0;i<com_pep;i++)
{
cin>>men[i].name;
men[i].ac_count=0;
men[i].time_p=0;
men[i].status.resize(com_que);
for(int j=0;j<com_que;j++)
{
string buf;
cin>>buf;
if(buf=="+")
{
int x,y;
cin>>x>>y;
men[i].status[j]='+';
men[i].ac_count++;
men[i].time_p+=20*(x-1)+y;
}
else if(buf=="-")
{
int x;
cin>>x;
men[i].status[j]='-';
}
else
{
men[i].status[j]='.';
}
}
}
for(int i=0;i<com_pep-1;i++)
{
for(int j=0;j<com_pep-i-1;j++)
{
if(men[j].ac_count<men[j+1].ac_count)
{
Player temp=men[j];
men[j]=men[j+1];
men[j+1]=temp;
}
else if(men[j].ac_count==men[j+1].ac_count&&men[j].time_p>men[j+1].time_p)
{
Player temp=men[j];
men[j]=men[j+1];
men[j+1]=temp;
}
}
}
for(int i=0;i<com_pep;i++)
{
cout<<men[i].name<<" ";
for(int j=0;j<com_que;j++)
{
cout<<men[i].status[j]<<" ";
}
cout<<endl;
}
}
return 0;
}