QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#49336#2281. BnPCXbz_24TL 0ms0kbC++231.4kb2022-09-20 10:57:192022-09-20 10:57:21

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-20 10:57:21]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2022-09-20 10:57:19]
  • 提交

answer

#include "iostream"
#include "vector"
#include "utility"
#include "algorithm"
using namespace std;
vector<int>l;
vector<int>r;
pair<vector<int>, vector<int>>p;

int first_loop(int n, int k)
{
    for(int i = 0;i<n;i++)
    {
        string s; int x;
        cin>>s>>x;
        l.push_back(x);
    }
    sort(l.begin(), l.end(), greater<int>());
    p.first = l;
    int num1 = n+k;
    for(int i = 0; i<l.size();i++)
    {
        if(num1 <= l[i])
        {
            break;
        }else
        {
            while(num1>l[i])
            {
                num1-=l[i];
            }
        }
    }
    return num1;
}
int second_loop(int n, int l){
    for(int i = 0;i<n;i++){
        string s; int x;
        cin>>s>>x;
        r.push_back(x);
    }
    sort(r.begin(), r.end(), greater<int>());
    p.second = r;
    int num1 = n+l;
    for(int i = 0; i<r.size();i++)
    {
        if(num1 <= r[i])
        {
            break;
        }else
        {
            while(num1>r[i])
            {
                num1-=r[i];
            }
        }
    }
    return num1;
}
int main()
{
    int n, k, l;
    cin>>n>>k;
    int x = first_loop(n, k);
    cin>>l;
    int x2 = second_loop(k, l);
    if (x == n+k)
        x = 0;
    if (x2==n+k)
        x2 = 0;
    if (x == 0 && x2 == 0)
        cout<<0<<endl;
    else
        cout<<x<<x2<<endl;
    return 0;
}

详细

Test #1:

score: 0
Time Limit Exceeded

input:

3 14
THISISTHEONE 8
B 0
C 0
8
THISISTHEONE 10
C 0
B 1
B 0
THISISTHEONE 0
C 1
THISISTHEONE 0
THISISTHEONE 0

output:


result: