比赛 |
20121106 |
评测结果 |
AAAAAAAAAAAA |
题目名称 |
H 指数因子 |
最终得分 |
100 |
用户昵称 |
不列颠呆毛 |
运行时间 |
0.010 s |
代码语言 |
C++ |
内存使用 |
3.15 MiB |
提交时间 |
2012-11-06 09:20:28 |
显示代码纯文本
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
using namespace std;
struct made{
string name;
int h;
};
typedef vector<int> v;
typedef vector<int>::iterator it;
typedef map<string,v>::iterator iter;
int n,s[101];
string name[101];
map<string,v> m;
vector<made> ans;
int cmp(made a,made b){
if (a.h!=b.h) return a.h>b.h;
return a.name<b.name;
}
int main(){
freopen("publish.in","r",stdin);
freopen("publish.out","w",stdout);
scanf("%d",&n);
for (int i=1; i<=n; i++) cin>>name[i];
for (int i=1; i<=n; i++){
string book; cin>>book;
for (int k=0; k<n; k++)
if (book[k]=='1') s[k+1]++;
}
for (int i=1; i<=n; i++)
m[name[i]].push_back(s[i]);
for (iter i=m.begin(); i!=m.end(); i++){
made x; x.name=i->first; x.h=0;
sort(i->second.begin(),i->second.end());
for (size_t k=0; k<i->second.size(); k++)
x.h=max(x.h,min(i->second[k],(int)(i->second.size()-k)));
ans.push_back(x);
}
sort(ans.begin(),ans.end(),cmp);
for (vector<made>::iterator i=ans.begin(); i!=ans.end(); i++)
cout<<i->name<<' '<<i->h<<endl;
return 0;
}