QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#242214 | #7041. Girls Band Party | maghrabyJr_# | WA | 431ms | 10576kb | C++20 | 2.6kb | 2023-11-07 01:23:07 | 2023-11-07 01:23:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
int dp[6][6][6][2];
void solve(){
int n; cin>>n;
bool goodName[n], goodColor[n];
::memset(dp, 0, sizeof dp);
::memset(goodColor, 0, sizeof goodColor);
::memset(goodName, 0, sizeof goodName);
string name[n], color[n];
int power[n];
for(int i = 0; i < n; i++){
cin>>name[i]>>color[i]>>power[i];
}
for(int i = 0; i < 5; i++){
string s; cin>>s;
for(int j = 0; j < n; j++){
if(name[j] == s)
goodName[j]= 1;
}
}
string cc; cin>>cc;
for(int i = 0; i < n; i++){
if(color[i] == cc){
goodColor[i]= 1;
}
}
for(int ca = 0; ca <= 5; ca++){
for(int na = 0; na <= 5; na++){
for(int pick = 0; pick <= 5; pick++){
dp[pick][na][ca][n & 1]= INT_MIN;
}
}
}
dp[0][0][0][n & 1] = 0;
for(int i = n - 1; i >= 0; i--){
int p = i & 1;
int q = p ^ 1;
for(int pick = 0; pick <= 5; pick++){
for(int na = 0; na <= 5; na++){
for(int ca = 0; ca <= 5; ca++){
dp[pick][na][ca][p] = dp[pick][na][ca][q];
if(pick && na - goodName[i] >= 0 && ca - goodColor[i] >= 0){
dp[pick][na][ca][p]= max(dp[pick][na][ca][p],
power[i] + dp[pick - 1][na - goodName[i]][ca - goodColor[i]][q]);
}
}
}
}
}
int ans = 0;
for(int na = 0; na <= 5; na++){
for(int ca = 0; ca <= 5; ca++){
int base = dp[5][na][ca][0];
int x = base + (99 + base * (10 * na + 20 * ca)) / 100;
ans= max(ans, x);
}
}
cout<<ans<<"\n";
}
int32_t main() {
cin.tie(0);
cout.sync_with_stdio(0);
int T; cin>>T;
while(T--) solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3604kb
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: -100
Wrong Answer
time: 431ms
memory: 10576kb
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 265698 185973 243666 225558 206514 110114 276209 223523 233074 561365 531402 474006 616758 393207 514193 598268 535133 409910 549831 624220 567022 624418 624510 624500 624600 624368 555860 624430 624390 623060 624075 624470 624300 623800 623910 620408 623725 624813 622893 624500 623043 624155...
result:
wrong answer 2nd numbers differ - expected: '265697', found: '265698'