A
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int a, b, c;
int main()
{
int test;
cin >> test;
while(test --)
{
priority_queue <int, vector<int>, greater<int> > hp;
cin >> a >> b >> c;
hp.push(a);
hp.push(b);
hp.push(c);
for (int i = 0; i < 5; i ++)
{
int x = hp.top();
hp.pop();
x ++;
hp.push(x);
}
int res = 1;
while(!hp.empty())
{
int x = hp.top();
res = res * x;
hp.pop();
}
cout << res << endl;
}
return 0;
}
B
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
const int N = 1e5 + 10;
int n, k;
int pot[N];
int main()
{
int test;
cin >> test;
while(test --)
{
cin >> n >> k;
for (int i = 1; i <= k; i ++) cin >> pot[i];
sort(pot + 1, pot + 1 + k);
long long res = 0;
long long sum = 0;
for (int i = 1; i < k; i ++)
{
int x = pot[i];
if(x == 1)
{
res ++;
continue;
}
res = res + x - 1 + x;
}
cout << res << endl;
}
return 0;
}
C
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
const int N = 2e5 + 10;
int n, m, k;
int main()
{
int test;
cin >> test;
while(test --)
{
cin >> n >> m >> k;
vector<int> res(n, 0);
int h = max(m, k), l = min(m, k);
int idx = 0;
for (int i = n; i > l; i --)
res[idx ++] = i;
for (int i = 1; i <= l; i ++)
res[idx ++] = i;
for (int i = 0; i < n; i ++) cout << res[i] << " ";
cout << endl;
}
return 0;
}
D
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
const int N = 2e5 + 10;
int n, m, k;
char river[N];
int main()
{
int test;
cin >> test;
while(test --)
{
cin >> n >> m >> k;
for (int i = 1; i <= n; i ++) cin >> river[i];
vector<int> wood;
wood.push_back(0);
for (int i = 1; i <= n; i ++)
if(river[i] == 'L')
wood.push_back(i);
wood.push_back(n + 1);
int cold = 0;
bool f = true;
for (int i = 0; i < (int)wood.size() - 1 && f && cold <= k; i ++)
{
int x = wood[i], y = wood[i + 1];
if(y - x <= m) continue;
int far = -1;
for(int j = x + 1; j <= x + m; j ++)
if(river[j] == 'W') far = max(far, j);
if(far == -1) {f = 0; break;}
cold ++;
for (int j = far + 1; j < y; j ++)
{
if(river[j] == 'C')
{
f = false;
break;
}
else cold ++;
}
}
if(cold > k || f == false) cout << "NO" << endl;
else cout << "YES" << endl;
//cout << res << endl;
}
return 0;
}