QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#49336 | #2281. BnPC | Xbz_24 | TL | 0ms | 0kb | C++23 | 1.4kb | 2022-09-20 10:57:19 | 2022-09-20 10:57:21 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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