QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#172517 | #7041. Girls Band Party | neko_nyaa# | AC ✓ | 273ms | 7876kb | C++23 | 1.4kb | 2023-09-09 19:35:37 | 2023-09-09 19:35:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18;
int dp[2][6][16];
void solve() {
int n; cin >> n;
map<string, vector<pair<string, int>>> cd;
for (int i = 0; i < n; i++) {
string x, y; int z; cin >> x >> y >> z;
cd[x].emplace_back(y, z);
}
vector<string> bn(5);
for (int i = 0; i < 5; i++) {
cin >> bn[i];
}
string bncol; cin >> bncol;
for (int i = 0; i <= 5; i++) {
for (int j = 0; j <= 15; j++) {
dp[0][i][j] = dp[1][i][j] = -INF;
}
}
dp[0][0][0] = dp[1][0][0] = 0;
for (auto [name, cards]: cd) {
for (int i = 0; i <= 5; i++) {
for (int j = 0; j <= 15; j++) {
dp[0][i][j] = dp[1][i][j];
}
}
int bonusBase = 0;
if (find(bn.begin(), bn.end(), name) != bn.end()) bonusBase = 1;
for (auto [col, pw]: cards) {
int bonus = bonusBase;
if (col == bncol) bonus += 2;
for (int i = 0; i+1 <= 5; i++) {
for (int j = 0; j+bonus <= 15; j++) {
dp[1][i+1][j+bonus] = max(dp[1][i+1][j+bonus], dp[0][i][j] + pw);
}
}
}
}
int ans = 0;
for (int i = 0; i <= 5; i++) {
for (int j = 0; j <= 15; j++) {
if (dp[1][i][j] <= 0) continue;
int sc = dp[1][i][j];
int bs = sc*(j/10.0);
ans = max(ans, sc+bs);
}
}
cout << ans << '\n';
}
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
int t; cin >> t;
while (t--) {
solve();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3560kb
input:
1 6 Saaya Power 45000 Kokoro Happy 45000 Kasumi Cool 45000 Rimi Power 45000 Aya Pure 45000 Aya Power 2000 Saaya Tae Kasumi Rimi Arisa Power
output:
382500
result:
ok 1 number(s): "382500"
Test #2:
score: 0
Accepted
time: 267ms
memory: 7876kb
input:
50 6 Tae Pure 13573 Chisato Happy 48889 Hina Power 36087 Kasumi Cool 5878 Rimi Power 21091 Rinko Cool 21035 Eve Tomoe Sayo Saya Tsugumi Power 8 Hina Power 33669 Kokoro Happy 48080 Tsugumi Cool 37215 Lisa Power 22671 Kaoru Pure 3556 Hagumi Happy 26536 Rimi Power 20561 Maya Power 29893 Kaoru Chisato H...
output:
196945 265697 185972 181747 190528 187408 110113 238308 223522 233073 561365 531401 474005 604145 393206 497631 598267 535132 404644 501993 623480 525683 623575 624482 624315 624057 624042 536709 624202 623755 622960 622482 624082 623832 623182 622470 618160 623535 624680 622372 624385 623042 622857...
result:
ok 50 numbers
Test #3:
score: 0
Accepted
time: 273ms
memory: 7744kb
input:
50 6 Rinko Cool 29445 Sayo Power 33447 Rimi Power 47202 Rinko Power 13982 Himari Power 2156 Moca Cool 45728 Kaoru Moca Hagumi Aya Kanon Happy 10 Misaki Pure 11868 Maya Pure 46263 Aya Power 36991 Tsugumi Happy 27068 Tomoe Pure 41757 Aya Cool 44328 Saaya Happy 46221 Arisa Cool 31545 Kanon Happy 25467 ...
output:
173775 321889 151163 255470 234021 199576 223339 262045 193091 225840 169657 191240 192443 222483 96308 184369 341478 181268 166455 258093 620735 610022 617712 623135 622237 623880 614360 622132 623332 623607 620665 618695 623477 619787 621477 623012 618887 616462 623855 622627 623852 624200 624540 ...
result:
ok 50 numbers