Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #ifdef ACMTUYO
- struct RTC{~RTC(){cerr << "Time: " << clock() * 1.0 / CLOCKS_PER_SEC <<" seconds\n";}} runtimecount;
- #define DBG(X) cerr << #X << " = " << X << '\n';
- #else
- struct RTC{};
- #define DBG(X)
- #endif
- #define fast_io() ios_base::sync_with_stdio(false)
- #define mp make_pair
- #define mt make_tuple
- #define pb push_back
- #define eb emplace_back
- #define sz(x) ((int)(x).size())
- #define all(c) (c).begin(),(c).end()
- #define forn(i, n) for (int i = 0; i < (n); i++)
- typedef long long int number;
- struct team{
- string nombre;
- int t;
- int p[20];
- int ac;
- team() {
- }
- team(string n) {
- nombre = n;
- t = 0;
- ac = 0;
- for(int i = 0; i < 20; i++)
- p[i] = 0;
- }
- void penalizar(int problem) {
- p[problem]++;
- }
- void accepted(int problem,int tiempo) {
- t += p[problem] * 20 + tiempo;
- ac++;
- }
- };
- vector<team> v;
- string myteam;
- int main() {
- int n,envios,problemas;
- cin>>n>>envios>>problemas;
- string s;
- for(int i = 0; i < n; i++) {
- cin>>s;
- team x(s);
- v.push_back(x);
- }
- myteam = v[0].nombre;
- string nom,id,resp;
- int tenvio;
- int start = 0, ans = 0;
- for(int i = 0; i < envios; i++) {
- cin>>nom>>id>>tenvio>>resp;
- int index = -1;
- for(int j = 0; j < n; j++) {
- if(v[j].nombre == nom) {
- index = j;
- break;
- }
- }
- string lider = v[0].nombre;
- //cout<<i<<": Lider "<<lider<<endl;
- if(resp == "NO"){
- v[index].penalizar(id[0] - 'A');
- }else {
- v[index].accepted(id[0] - 'A', tenvio);
- while(index > 0) {
- if(v[index].ac > v[index - 1].ac) {
- swap(v[index],v[index - 1]);
- }else {
- if(v[index].ac == v[index - 1].ac) {
- if(v[index].t < v[index - 1].t) {
- swap(v[index],v[index - 1]);
- }else {
- break;
- }
- }else {
- break;
- }
- }
- index--;
- }
- if(lider != v[0].nombre) {
- if(lider == myteam) {
- ans += (tenvio - start);
- }else {
- if(v[0].nombre == myteam) {
- // cout<<"inicio en: "<<tenvio<<endl;
- start = tenvio;
- }
- }
- }
- }
- }
- cout<<ans<<"\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement