QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#598030 | #9347. Competition in Swiss-system | FreeTimeLove | WA | 1ms | 3948kb | C++14 | 3.4kb | 2024-09-28 20:09:19 | 2024-09-28 20:09:20 |
Judging History
answer
#include<bits/stdc++.h>
namespace FRTMLV{
//#define ll long long
#define LD long double
#define i7 __int128
#define re return
#define con continue
using namespace std;
template<class T>inline bool ckmin(T &a,T b){re b<a?a=b,1:0;}
template<class T>inline bool ckmax(T &a,T b){re a<b?a=b,1:0;}
const int N=1e4+5;
inline int rd(){
int d=1,k=0;char c=getchar();
while(!(c>='0' and c<='9' or c=='-'))c=getchar();if(c=='-')d=-1,c=getchar();
while(c>='0' and c<='9')k=(k<<3)+(k<<1)+(c^48),c=getchar();
return d*k;
}
int n,m,rod[20];
vector<int>e[N];
int mcnt[N],gcnt[N],gw[N],mw[N],bk[N];
//inline void out(ll x,ll y){
// ll g=__gcd(x,y);
// x/=g,y/=g;
// if(x*3<y)printf("1/3 ");
// else printf("%lld/%lld ",x,y);
//}
void OUT(i7 x){
if(!x)re;
OUT(x/10);
printf("%d",(signed)(x%10));
}
#define int ll
#define ll i7
struct xxs{
ll x,y;
inline void gt(){
ll g=__gcd(x,y);
x/=g,y/=g;
}
void out(){
if(x*3<y)printf("1/3 ");
// else printf("%lld/%lld ",x,y);
else OUT(x),printf("/"),OUT(y),printf(" ");
}
};
xxs operator +(const xxs &a,const xxs &b){
xxs ans={a.x*b.y+a.y*b.x,a.y*b.y};
ans.gt();re ans;
}
void calc1(int id){
if(!e[id].size()){printf("1/3 ");re;}
xxs ans={0,1};
for(auto &j:e[id]){
xxs tmp={mw[j],mcnt[j]*3};
if(tmp.x*3<tmp.y)tmp={1,3};
ans=ans+tmp;
}
ans.y*=(int)e[id].size();
ans.gt();ans.out();
}
void calc2(int id){
if(!e[id].size()){printf("1/3 ");re;}
xxs ans={0,1};
for(auto &j:e[id]){
xxs tmp={gw[j],gcnt[j]*3};
if(tmp.x*3<tmp.y)tmp={1,3};
ans=ans+tmp;
}
ans.y*=(int)e[id].size();
ans.gt();ans.out();
}
signed main(){
// freopen("data.in","r",stdin);
// freopen("std.out","w",stdout);
int T=rd();
while(T--){
n=rd(),m=rd();
for(int i=1;i<=m;i++)rod[i]=rd();
for(int i=1;i<=n;i++){
mcnt[i]=gcnt[i]=gw[i]=mw[i]=0;
e[i].clear();
}
for(int round=1;round<=m;round++){
for(int i=1;i<=n;i++)bk[i]=0;
for(int k=1;k<=rod[round];k++){
int l=rd(),r=rd();
bk[l]=bk[r]=1;
int p0=rd(),p2=rd(),p1=rd();//win lose tie
int wl=p0*3+p1,wr=p2*3+p1,cnt=p0+p1+p2;
++mcnt[l],++mcnt[r];
gcnt[l]+=cnt,gcnt[r]+=cnt;
gw[l]+=wl,gw[r]+=wr;
if(wl==wr)mw[l]++,mw[r]++;
else if(wl>wr)mw[l]+=3;
else mw[r]+=3;
e[l].push_back(r),e[r].push_back(l);
}
for(int i=1;i<=n;i++)
if(!bk[i]){
++mcnt[i],gcnt[i]+=2;
mw[i]+=3,gw[i]+=6;
}
OUT(round);
// printf("Round %lld\n",round);
puts("");
for(int i=1;i<=n;i++){
// printf("%lld ",mw[i]);
OUT(mw[i]);
printf(" ");
// printf("%lld ",mw[i]);
calc1(i);//omw
xxs ans={gw[i],gcnt[i]*3};
ans.gt();ans.out();
calc2(i);//ogw
puts("");
}
}
}
re 0;
}
/*
2
2 3
0 1 1
1 2 2 0 1
1 2 1 1 1
3 2
1 1
1 2 0 2 0
2 3 2 0 0
*/
}signed main(){re FRTMLV::main();}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3948kb
input:
2 2 3 0 1 1 1 2 2 0 1 1 2 1 1 1 3 2 1 1 1 2 0 2 0 2 3 2 0 0
output:
1 3 1/3 1/1 1/3 3 1/3 1/1 1/3 2 6 1/2 13/15 7/15 3 1/1 7/15 13/15 3 7 4/9 17/24 11/24 4 7/9 11/24 17/24 1 1/1 1/3 1/1 3 1/3 1/1 1/3 3 1/3 1/1 1/3 2 3 1/1 1/2 1/1 6 1/2 1/1 1/2 3 1/1 1/2 1/1
result:
wrong answer 1st lines differ - expected: 'Round 1', found: '1'