QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#676103#7041. Girls Band PartyH__MWA 1087ms333184kbC++142.2kb2024-10-25 20:19:562024-10-25 20:19:56

Judging History

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

  • [2024-10-25 20:19:56]
  • 评测
  • 测评结果:WA
  • 用时:1087ms
  • 内存:333184kb
  • [2024-10-25 20:19:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
const int N = 2e5 + 10;
const int inf = -1e18;
ll f[N][10][20];
string tt[N];
bool st[N];
struct node
{
    string a;
    string b;
    int c;
};
bool cmp(node a , node b)
{
    return a.a < b.a;
}
void solve()
{
    int n ;
    cin >> n;
    vector<node> v2;
    map<string , int > mp;
    vector<vector<pair<int , int > > > v(2 * n + 1);
    int cnt = 1;
    for(int i = 1 ; i <= n ; i++)
    {
        string a, b;
        int c;
        cin >> a >> b >> c;
        v2.push_back({a, b , c});
        if(mp.find(a) == mp.end()) mp[a] = cnt++;
        if(mp.find(b) == mp.end()) mp[b] = cnt++;
    }
    for(int i = 0 ; i < 5 ; i++)
    {
        string a;
        cin >> a;
        if(mp.find(a) == mp.end()) mp[a] = cnt++;
        st[mp[a]] = 1;
    }
    string b;
    cin >> b;
    if(mp.find(b) == mp.end()) mp[b] = cnt++;
    int bs = mp[b];
    
    for(int j = 0 ; j < v2.size() ; j++)
    {
        int a = mp[v2[j].a];
        int b = mp[v2[j].b];
        int c = v2[j].c;
        v[a].push_back({b, c});
    }
    for(int i = 0 ; i <= cnt ; i++)
        for(int j = 0 ; j <= 5 ; j++)
            for(int k = 0 ; k <= 15 ; k++)
                f[i][j][k] = inf;
    
    f[0][0][0] = 0;
    for(int i = 1 ; i < v.size() ; i++)
    {
        for(int j = 0 ; j <= 5 ; j++)
        {
            for(int k = 0 ; k <= 15 ; k++)
            {
                f[i][j][k] = max(f[i][j][k] , f[i - 1][j][k]);
                for(auto t : v[i])
                {
                    int t2 = t.first;
                    int val = t.second;
                    int w = 0;
                    if(st[i]) w += 1;
                    if(bs == t2) w += 2;
                    if(k >= w && j >= 1)
                        f[i][j][k] = max(f[i][j][k] , val + f[i - 1][j - 1][k - w]);
                }
            }
        }
    }
    int ans = 0;
    for(int i = 0; i <= 15 ; i++)
        ans = max(ans , (int) (f[cnt - 1][5][i] * (i * 0.1 + 1)));
    cout << ans << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while(t--)
        solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 11032kb

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: 1087ms
memory: 333184kb

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:

0
280628
200278
195728
206104
0
0
285969
257463
0
608375
600440
519149
620060
465462
565490
614822
612890
450579
581672
624927
609287
624875
624952
624880
624950
624835
603172
624812
624710
624760
624662
624810
624832
624810
624867
624542
624825
624960
624710
624915
624762
624837
624585
624885
62486...

result:

wrong answer 1st numbers differ - expected: '196945', found: '0'