QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#673546 | #7041. Girls Band Party | H__M | AC ✓ | 3340ms | 29832kb | C++14 | 2.6kb | 2024-10-24 23:32:40 | 2024-10-24 23:32:40 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int inf = -1e8;
int f[N][10][20];
// map<string , vector<string , int > > mp;
map<string , int > mp2;
string tt[N];
struct node
{
string a;
string b;
int c;
};
bool cmp(node a , node b)
{
return a.a < b.a;
}
// map<pair<int , int >
set<string> s;
void solve()
{
int n ;
cin >> n;
vector<vector< pair<string , int> > > v(n + 1);
mp2.clear();
vector<node> v2;
set<string> s;
int cnt = 1;
string bs;
for(int i = 1; i <= n ; i++)
{
string a , b;
cin >> a >> b;
int c;
cin >> c;
v2.push_back({a , b , c});
// if(mp2.find(a) == mp2.end()) mp2[a] = cnt, tt[cnt++] = a;
// v[mp2[a]].push_back({b, c});
}
sort(v2.begin() , v2.end() , cmp);
for(int i = 0 ; i < 5 ; i ++)
{
string tmp;
cin >> tmp;
s.insert(tmp);
}
cin >> bs;
for(int i = 0 ; i < n ; i++)
{
int j = i;
while(j < n && v2[j].a == v2[i].a)
{
v[cnt].push_back({v2[j].b , v2[j].c});
j++;
}
i = j - 1;
tt[cnt] = v2[i].a;
cnt++;
}
for(int i = 0 ; i < cnt ; i++)
{
//cerr << "&&&&" << ' ' << " " << i << endl;
for(int j = 0 ; j <= 5 ; j++)
{
//cerr << "&&&&" << ' ' << j<< " " << i << endl;
for(int k = 0 ; k <= 15 ; k++)
{
f[i][j][k] = inf;
}
}
}
f[0][0][0] = 0;
for(int i = 1 ; i < cnt ; 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]);
string t1 = tt[i];
int vv = 0;
if(s.count(t1)) vv = 1;
for(int p = 0 ; p < v[i].size() ; p++)
{
auto t = v[i][p];
string t2 = t.first;
int val = t.second;
int w = vv;
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;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while(t--)
solve();
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 11756kb
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: 3340ms
memory: 29708kb
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: 3154ms
memory: 29832kb
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