QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#580737#9370. Gambling on Choosing RegionalsportagTL 1ms6944kbC++231.5kb2024-09-21 23:26:452024-09-21 23:26:45

Judging History

你现在查看的是最新测评结果

  • [2024-09-21 23:26:45]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:6944kb
  • [2024-09-21 23:26:45]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
map<string, vector<int>> mp;
int vv[N];
string tp[N];

bool cmp(int a, int b)
{
    return a > b;
}

int main()
{
    int n, m;
    cin >> n >> m;
    int mig = 0x3f3f3f3f;
    for (int i = 0; i < m; i++)
    {
        int x;
        cin >> x;
        mig = min(mig, x);
    }
    for (int i = 0; i < n; i++)
    {
        cin >> vv[i] >> tp[i];
        mp[tp[i]].push_back(vv[i]);
    }
    /*for (auto it : mp)
    {
        cout << it.first;
        sort(it.second.begin(), it.second.end(), cmp);
        for (auto j : it.second)
        {
            cout << j;
        }
        cout << "\n";
    }
    for (auto it : mp)
    {
        cout << it.first;
        for (auto j : it.second)
        {
            cout << j;
        }
        cout << "\n";
    }*/

    for (int i = 0; i < n; i++)
    {
        int ans = 1;
        for (auto it : mp)
        {
            sort(it.second.begin(), it.second.end(), cmp);
            int cot = mig;
            if (it.first == tp[i])
                cot--;
            for (auto j : it.second)
            {
                if(cot--<=0)
                    break;
                //cout << it.first << " " << j << " ";
                
                if (j > vv[i])
                    ans++;
                else
                    break;
            }
        }
        cout << ans << "\n";
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 6944kb

input:

5 3
1 2 3
100 THU
110 PKU
95 PKU
105 THU
115 PKU

output:

2
1
2
2
1

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 6536kb

input:

5 2
2 3
100 THU
110 PKU
95 PKU
105 THU
115 PKU

output:

4
2
4
3
1

result:

ok 5 lines

Test #3:

score: -100
Time Limit Exceeded

input:

100000 100000
57148 51001 13357 71125 98369 67226 49388 90852 66291 39573 38165 97007 15545 51437 89611 41523 27799 15529 16434 44291 47134 90227 26873 52252 41605 21269 9135 55784 70744 17563 79061 73981 70529 35681 91073 52031 23811 79501 1607 46365 76868 72137 71041 29217 96749 46417 40199 55907 ...

output:


result: