QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#242213#7041. Girls Band PartymaghrabyJr_#WA 476ms10480kbC++202.8kb2023-11-07 01:19:392023-11-07 01:19:39

Judging History

你现在查看的是最新测评结果

  • [2023-11-07 01:19:39]
  • 评测
  • 测评结果:WA
  • 用时:476ms
  • 内存:10480kb
  • [2023-11-07 01:19:39]
  • 提交

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;
                           for(int i = 0; i < na; i++){
                                    x += base / 10;
                           }
                           for(int i = 0; i < ca; i++){
                                    x += base / 5;
                           }
                           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: 1ms
memory: 3432kb

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: 476ms
memory: 10480kb

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
225557
206514
110113
276206
223522
233073
561361
531396
474003
616753
393205
514190
598262
535130
409909
549827
624213
567014
624412
624504
624500
624600
624362
555853
624427
624386
623054
624075
624463
624300
623800
623904
620403
623725
624810
622887
624500
623037
624152...

result:

wrong answer 4th numbers differ - expected: '181747', found: '243665'