QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#324306 | #8230. Submissions | ucup-team987# | Compile Error | / | / | C++17 | 3.2kb | 2024-02-10 17:43:48 | 2024-02-10 17:43:48 |
Judging History
你现在查看的是最新测评结果
- [2024-05-20 23:50:57]
- hack成功,自动添加数据
- (/hack/623)
- [2024-05-20 23:48:44]
- hack成功,自动添加数据
- (/hack/622)
- [2024-02-10 17:43:48]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-02-10 17:43:48]
- 提交
answer
#include<iostream>
#include<vector>
#include<algorithm>
#include<cassert>
using namespace std;
int M;
int C[1<<17];
string Cs[1<<17];
int P[1<<17];
int T[1<<17];
bool S[1<<17];
void solve()
{
cin>>M;
vector<string>team_name(M);
for(int i=0;i<M;i++)
{
string s;
char Pc;
cin>>Cs[i]>>Pc>>T[i]>>s;
S[i]=s[0]=='a';
P[i]=Pc-'A';
team_name[i]=Cs[i];
}
sort(team_name.begin(),team_name.end());
team_name.erase(unique(team_name.begin(),team_name.end()),team_name.end());
if(team_name.size()==1)
{
cout<<"1\n"<<team_name[0]<<"\n";
return;
}
vector<array<vector<pair<int,bool> >,26> >Sub(team_name.size());
for(int i=0;i<M;i++)
{
C[i]=lower_bound(team_name.begin(),team_name.end(),Cs[i])-team_name.begin();
Sub[C[i]][P[i]].push_back(make_pair(T[i],S[i]));
}
int N=0;
vector<int>AC(team_name.size()),Penalty(team_name.size());
vector<pair<pair<int,int>,int> >leader(team_name.size());
for(int i=0;i<team_name.size();i++)
{
int penalty=0,ac=0;
for(int j=0;j<26;j++)if(Sub[i][j].size())
{
int k=0;
while(k<Sub[i][j].size()&&!Sub[i][j][k].second)k++;
if(k==Sub[i][j].size())continue;
penalty+=k*20+Sub[i][j][k].first;
ac++;
}
AC[i]=ac;
Penalty[i]=penalty;
leader[i]=make_pair(make_pair(-ac,penalty),i);
if(ac>0)N++;
}
sort(leader.begin(),leader.end());
vector<int>WIN(team_name.size()+1);
{//orig
int w=min(35,(N+9)/10);
if(w>=1)
{
pair<int,int>p=leader[w-1].first;
WIN[0]++;
WIN[upper_bound(leader.begin(),leader.end(),make_pair(p,(int)1e9))-leader.begin()]--;
}
}
for(int id=0;id<team_name.size();id++)
{
int i=leader[id].second;
auto check=[&](int ac,int penalty,int n){
int w=min((n+9)/10,35);
if(w==0)return;
pair<int,int>np=make_pair(-ac,penalty);
pair<int,int>p=leader[id<=w-1?w:w-1].first;
if(np<=p)
{
WIN[id]++;WIN[id+1]--;
p=np;
if(w>=2)p=max(p,leader[id<=w-2?w-1:w-2].first);
}
int r=upper_bound(leader.begin(),leader.end(),make_pair(p,(int)1e9))-leader.begin();
WIN[0]++;
WIN[r]--;
if(id<r)WIN[id]--,WIN[id+1]++;
};
for(int j=0;j<26;j++)if(Sub[i][j].size())
{
int fa=-1,sa=-1;
for(int k=0;k<Sub[i][j].size();k++)if(Sub[i][j][k].second)
{
if(fa==-1)fa=k;
else if(sa==-1)sa=k;
}
if(fa==-1)
{//no ac
for(int k=0;k<Sub[i][j].size();k++)
{
int ac=AC[i]+1;
int penalty=Penalty[i]+k*20+Sub[i][j][k].first;
int n=N+(AC[i]==0);
check(ac,penalty,n);
}
}
else
{
for(int k=0;k<fa;k++)
{
int ac=AC[i];
int penalty=Penalty[i]-(fa-k)*20+Sub[i][j][k].first;
check(ac,penalty,N);
}
{
int ac=AC[i],penalty=Penalty[i];
penalty-=fa*20+Sub[i][j][fa].first;
if(sa==-1)ac--;
else penalty+=sa*20+Sub[i][j][sa].first;
check(ac,penalty,N-(ac==0));
}
}
}
}
vector<string>ans;
for(int id=0;id<team_name.size();id++)
{
WIN[id+1]+=WIN[id];
if(WIN[id]>0)
{
int i=leader[id].second;
ans.push_back(team_name[i]);
}
}
cout<<ans.size()<<"\n";
for(int i=0;i<ans.size();i++)cout<<ans[i]<<(i+1==ans.size()?"\n":" ");
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;cin>>T;
for(;T--;)solve();
}
Details
answer.code: In function ‘void solve()’: answer.code:36:26: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 36 | Sub[C[i]][P[i]].push_back(make_pair(T[i],S[i])); | ^ answer.code:44:47: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 44 | for(int j=0;j<26;j++)if(Sub[i][j].size()) | ^ answer.code:47:39: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 47 | while(k<Sub[i][j].size()&&!Sub[i][j][k].second)k++; | ^ answer.code:47:58: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 47 | while(k<Sub[i][j].size()&&!Sub[i][j][k].second)k++; | ^ answer.code:48:37: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 48 | if(k==Sub[i][j].size())continue; | ^ answer.code:49:45: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 49 | penalty+=k*20+Sub[i][j][k].first; | ^ answer.code:87:47: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 87 | for(int j=0;j<26;j++)if(Sub[i][j].size()) | ^ answer.code:90:45: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 90 | for(int k=0;k<Sub[i][j].size();k++)if(Sub[i][j][k].second) | ^ answer.code:90:69: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 90 | for(int k=0;k<Sub[i][j].size();k++)if(Sub[i][j][k].second) | ^ answer.code:97:53: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 97 | for(int k=0;k<Sub[i][j].size();k++) | ^ answer.code:100:75: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<std::vector<std::pair<int, bool> >, 26> >, std::array<std::vector<std::pair<int, bool> >, 26> >::value_type’ {aka ‘std::array<std::vector<std::pair<int, bool> >, 26>’} and ‘int’) 100 | int penalty=Penalty[i]+k*20+Sub[i][j][k].first; | ^ answer.code:110:80: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::array<st...