求球赛AC代码

看了半天看不出错误,真的niupi
全部评论
球赛真的不知道哪里出了问题,名字按字母序也考虑了,一直30%,另外两题倒还是挺**的基本一遍过(除了有一次把没冲突要输出YES直接忽略了之外.........)
点赞 回复 分享
发布于 2017-09-16 17:21
#include "iostream" #include "vector" #include "algorithm" #include "unordered_set" #include "set" #include "unordered_map" #include "cstdio" #include "queue" #include "algorithm" #include "climits" #include "map" #include "stack" #include "cstring" #include "climits" using namespace std; #define ll long long #define mod 1000000007 struct score{     int s;     int v;     int l;     string name;     score(string s):name(s),s(0),v(0),l(0){} }; void getName(string s,string& a,string& b){     int i=0;     while(s[i]!='-')i++;     a=s.substr(0,i);     b=s.substr(i+1,s.length()-i-1); } void getS(string s,int& a,int& b){     int i=0;     while(s[i]!=':')i++;     a=0;b=0;     for(int j=0;j<i;j++)a=10*a+s[j]-'0';     for(int j=i+1;j<s.length();j++)b=10*b+s[j]-'0'; } bool cmp(score* a,score* b){     if(a->s>b->s)return true;     if(a->s<b->s)return false;     if((a->v-a->l)>(b->v-b->l))return true;     if((a->v-a->l)<(b->v-b->l))return false;     return (a->v)>(b->v); } int main(){     int n;     while(cin>>n){         unordered_map<string,int> map;         vector<score*> a(n);         int i;         string name;         for(i=0;i<n;i++){             cin>>name;             a[i]=new score(name);             map[name]=i;         }         int L=n*(n-1)/2;         string p,q;         string name1,name2;         int s1,s2;         for(i=0;i<L;i++){             cin>>p>>q;             getName(p,name1,name2);             getS(q,s1,s2);             //cout<<name1<<" "<<name2<<endl;             int id1=map[name1];             int id2=map[name2];             a[id1]->v+=s1;             a[id2]->v+=s2;             a[id1]->l+=s2;             a[id2]->l+=s1;             if(s1>s2){                 a[id1]->s+=3;             }else if(s1==s2){                 a[id1]->s+=1;                 a[id2]->s+=1;             }else{                 a[id2]->s+=3;             }         }         sort(a.begin(),a.end(),cmp);         for(int i=0;i<n;i++){             //cout<<a[i]->name<<" "<<a[i]->s<<" "<<a[i]->v<<" "<<a[i]->l<<endl;         }         n/=2;         vector<string> result(n);         for(int i=0;i<n;i++){             result[i]=a[i]->name;         }         sort(result.begin(),result.end());         for(int i=0;i<n;i++){             cout<<result[i]<<endl;         }     }     return 0; } 40%...
点赞 回复 分享
发布于 2017-09-16 17:19
同看不出错误。。。  只过了40%  心好累啊  。。。
点赞 回复 分享
发布于 2017-09-16 17:15

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
正在热议
更多
# 春招至今,你的战绩如何? #
11078次浏览 94人参与
# 你的实习产出是真实的还是包装的? #
1960次浏览 42人参与
# 巨人网络春招 #
11369次浏览 223人参与
# 军工所铁饭碗 vs 互联网高薪资,你会选谁 #
7643次浏览 43人参与
# 简历第一个项目做什么 #
31746次浏览 341人参与
# 重来一次,我还会选择这个专业吗 #
433549次浏览 3926人参与
# MiniMax求职进展汇总 #
24119次浏览 309人参与
# 当下环境,你会继续卷互联网,还是看其他行业机会 #
187211次浏览 1122人参与
# 牛客AI文生图 #
21446次浏览 238人参与
# 不考虑薪资和职业,你最想做什么工作呢? #
152452次浏览 888人参与
# 研究所笔面经互助 #
118967次浏览 577人参与
# 简历中的项目经历要怎么写? #
310365次浏览 4219人参与
# AI时代,哪些岗位最容易被淘汰 #
63831次浏览 828人参与
# 面试紧张时你会有什么表现? #
30513次浏览 188人参与
# 你今年的平均薪资是多少? #
213144次浏览 1039人参与
# 你怎么看待AI面试 #
180143次浏览 1258人参与
# 高学历就一定能找到好工作吗? #
64331次浏览 620人参与
# 你最满意的offer薪资是哪家公司? #
76546次浏览 374人参与
# 我的求职精神状态 #
448135次浏览 3129人参与
# 正在春招的你,也参与了去年秋招吗? #
363518次浏览 2638人参与
# 腾讯音乐求职进展汇总 #
160677次浏览 1112人参与
# 校招笔试 #
471199次浏览 2964人参与
牛客网
牛客网在线编程
牛客网题解
牛客企业服务