QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#242212 | #7041. Girls Band Party | maghrabyJr_# | WA | 431ms | 10524kb | C++20 | 2.8kb | 2023-11-07 01:17:38 | 2023-11-07 01:17:38 |
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];
double x = base;
for(int i = 0; i < na; i++){
x += base * 0.1;
}
for(int i = 0; i < ca; i++){
x += base * 0.2;
}
ans= max(ans, (int)floor(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: 3824kb
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: 10524kb
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 243665 225558 206514 110113 276208 223522 233073 561365 531401 474005 616757 393206 514192 598267 535132 409910 549830 624220 567021 624417 624510 624500 624600 624367 555859 624430 624389 623060 624075 624470 624300 623800 623910 620407 623725 624812 622892 624500 623042 624155...
result:
wrong answer 4th numbers differ - expected: '181747', found: '243665'