QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#600664 | #9347. Competition in Swiss-system | WrongAnswer_90 | WA | 129ms | 6068kb | C++23 | 6.8kb | 2024-09-29 18:12:08 | 2024-09-29 18:12:09 |
Judging History
answer
#include<bits/stdc++.h>
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define ll long long
#define lll __int128
#define fi first
#define se second
#define e emplace
#define eb emplace_back
#define db double
#define ef emplace_front
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vp vector<pii>
#define vt vector<tup>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define FastI
#define FastO
#define int lll
bool ST;
static const ll MOD=1e8+7,Phi=998244352,inv2=499122177,Root=3,iRoot=332748118;
static const ll inf=1073741823,Inf=4294967296,INF=4557430888798830399;
static const ld eps=1e-9,pi=3.1415926535;
char in[1<<20],*p1=in,*p2=in;
char out[1<<20],*p3=out;
using namespace std;
struct tup
{
int x,y,z;
tup(int X=0,int Y=0,int Z=0)
{x=X,y=Y,z=Z;}
};
#ifdef FastI
#define getchar() (p1==p2&&(p2=(p1=in)+fread(in,1,1<<20,stdin),p1==p2)?EOF:*p1++)
#endif
#ifdef FastO
#define putchar(x) (p3-out==1<<20?fwrite(out,1,1<<20,stdout),p3=out,0:0,*p3++=x)
#define puts(x) write(x,'\n')
#endif
namespace FastIO
{
template<typename T> inline void write(T x,char ch=' ')
{
if(is_same<char,T>::value)putchar(x);
else
{
if(x<0)x=-x,putchar('-');
static char st[25];
int top=0;
do st[top++]=x%10+'0',x/=10;while(x);
while(top)putchar(st[--top]);
}
ch!='~'?putchar(ch):0;
}
inline void write(const char*x,char ch=' ')
{
for(int i=0;x[i]!='\0';++i)putchar(x[i]);
ch!='~'?putchar(ch):0;
}
inline void read(char&s){do s=getchar();while(s=='\n'||s==' ');}
inline void read(char s[])
{
int len=0;char st;
do st=getchar();while(st=='\n'||st==' ');
s[++len]=st,st=getchar();
while(st!='\n'&&st!=' ')s[++len]=st,st=getchar();
s[++len]='\0';
}
template<typename T> inline void read(T &s)
{
char ch=getchar();s=0;
while((ch>'9'||ch<'0')&&ch!='-')ch=getchar();
bool tf=(ch=='-'&&(ch=getchar()));
while(ch>='0'&&ch<='9')s=(s<<1)+(s<<3)+ch-'0',ch=getchar();
s=tf?-s:s;
}
inline void edl(){putchar('\n');}
template<typename T1,typename T2> inline void read(pair<T1,T2> &s){read(s.fi),read(s.se);}
template<typename T,typename...Args> inline void write(T x,Args...args){write(x,'~'),write(args...);}
template<typename T,typename...Args> inline void read(T&x,Args&...args){read(x),read(args...);}
#ifdef FastO
struct Writer{~Writer(){fwrite(out,1,p3-out,stdout);}}Writ;
#endif
}
using namespace FastIO;
namespace MTool
{
inline int Cadd(int a,int b){return (ll)a+b>=MOD?(ll)a+b-MOD:a+b;}
inline int Cdel(int a,int b){return a-b<0?a-b+MOD:a-b;}
inline int Cmul(int a,int b){return 1ll*a*b%MOD;}
inline int sqr(int a){return 1ll*a*a%MOD;}
inline void Madd(int&a,int b){a=((ll)a+b>=MOD?(ll)a+b-MOD:a+b);}
inline void Mdel(int&a,int b){a=(a-b<0?a-b+MOD:a-b);}
inline void Mmul(int&a,int b){a=1ll*a*b%MOD;}
inline int Cmod(int x){return (x%MOD+MOD)%MOD;}
inline void Mmod(int&x){x=(x%MOD+MOD)%MOD;}
template<typename T> inline bool Mmax(T&a,T b){return a<b?a=b,1:0;}
template<typename T> inline bool Mmin(T&a,T b){return a>b?a=b,1:0;}
template<typename...Args> inline void Madd(int&a,int b,Args...args){Madd(a,b),Madd(a,args...);}
template<typename...Args> inline void Mmul(int&a,int b,Args...args){Mmul(a,b),Mmul(a,args...);}
template<typename...Args> inline void Mdel(int&a,int b,Args...args){Mdel(a,b),Mdel(a,args...);}
template<typename...Args> inline int Cadd(int a,int b,Args...args){return Cadd(Cadd(a,b),args...);}
template<typename...Args> inline int Cmul(int a,int b,Args...args){return Cmul(Cmul(a,b),args...);}
template<typename...Args> inline int Cdel(int a,int b,Args...args){return Cdel(Cdel(a,b),args...);}
template<typename...Args,typename T> inline bool Mmax(T&a,T b,Args...args){return Mmax(a,b)|Mmax(a,args...);}
template<typename...Args,typename T> inline bool Mmin(T&a,T b,Args...args){return Mmin(a,b)|Mmin(a,args...);}
inline int power(int x,int y){int s=1;for(;y;y>>=1,Mmul(x,x))if(y&1)Mmul(s,x);return s;}
}
using namespace MTool;
namespace WrongAnswer_90
{
int n,m;
int contestwin[10010],contestall[10010];
int gamewin[10010],gameall[10010];
pii game[10010],contest[10010];
vi G[10010];
bool vis[10010],lst[10010];
db a[10010],b[10010];
int X[20];
pii get(int x,int y)
{
int d=__gcd(x,y);
return mp(x/d,y/d);
}
pii add(pii x,pii y)
{
pii z;
z.fi=x.fi*y.se+x.se*y.fi;
z.se=x.se*y.se;
return get(z.fi,z.se);
}
pii get(pii x,pii y)
{
if(x.fi*y.se>y.fi*x.se)return x;
return y;
}
inline void mian()
{
// cerr<<get(mp(0,1),mp(1,2)).fi<<" ";
// cerr<<get(mp(0,1),mp(1,2)).se<<" ";
// exit(0);
read(n,m);int x,a,b,c,d,e;
for(int i=1;i<=n;++i)
{
G[i].clear(),lst[i]=1;
contestwin[i]=contestall[i]=0;
gamewin[i]=gameall[i]=0;
}
for(int i=1;i<=m;++i)read(X[i]);
for(int i=1;i<=m;++i)
{
for(int i=1;i<=n;++i)vis[i]=0;
while(X[i]--)
{
read(a,b,c,d,e);
vis[a]=vis[b]=1;
gamewin[a]+=c*3+e;
gamewin[b]+=d*3+e;
gameall[a]+=(c+d+e)*3;
gameall[b]+=(c+d+e)*3;
contestall[a]+=3;
contestall[b]+=3;
if(c==d)
contestwin[a]++,contestwin[b]++;
else if(c==2)contestwin[a]+=3;
else contestwin[b]+=3;
G[a].eb(b),G[b].eb(a);
}
for(int j=1;j<=n;++j)if(!vis[j])
{
contestall[j]+=3;
contestwin[j]+=3;
gamewin[j]+=6;
gameall[j]+=6;
}
else lst[j]=0;
write("Round ",i,'\n');
// for(int i=1;i<=n;++i)write(lst[i]);puts("");
// for(int i=1;i<=n;++i)write(vis[i]);puts("");
// for(int i=1;i<=n;++i)write(gamewin[i]);puts("");
// for(int i=1;i<=n;++i)write(gameall[i]);puts("");
for(int j=1;j<=n;++j)
{
game[j]=get(mp(1,3),get(gamewin[j],gameall[j]));
contest[j]=get(mp(1,3),get(contestwin[j],i*3));
}
// for(int j=1;j<=n;++j)write(contest[j].fi,' ',contest[j].se,'\n');
// puts("");
for(int j=1;j<=n;++j)
{
write(contestwin[j]);
if(lst[j])write(1,'/',3,' ');
else
{
pii p=mp(0,1);
// cerr<<j<<" with ";
for(auto to:G[j])p=add(p,contest[to]);
p=get(p.fi,p.se*G[j].size());
write(p.fi,'/',p.se,' ');
}
{
pii p=get(mp(1,3),get(gamewin[j],gameall[j]));
write(p.fi,'/',p.se,' ');
}
if(lst[j])write(1,'/',3,' ');
else
{
pii p=mp(0,1);
for(auto to:G[j])p=add(p,game[to]);
p=get(p.fi,p.se*G[j].size());
write(p.fi,'/',p.se,' ');
}
puts("");
}
}
}
inline void Mian()
{
int T=1;
read(T);
while(T--)mian();
}
}
bool ED;
signed main()
{
// freopen("1.in","r",stdin);
// freopen("1.out","w",stdout);
double st=clock();
WrongAnswer_90::Mian();
double ed=clock();
cerr<<endl;
cerr<<"Time: "<<ed-st<<" ms\n";
cerr<<"Memory: "<<abs(&ST-&ED)/1024.0/1024.0<<" MB\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5984kb
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:
Round 1 3 1/3 1/1 1/3 3 1/3 1/1 1/3 Round 2 6 1/2 13/15 7/15 3 1/1 7/15 13/15 Round 3 7 4/9 17/24 11/24 4 7/9 11/24 17/24 Round 1 0 1/1 1/3 1/1 3 1/3 1/1 1/3 3 1/3 1/1 1/3 Round 2 3 1/1 1/2 1/1 6 1/2 1/1 1/2 3 1/1 1/2 1/1
result:
ok 17 lines
Test #2:
score: -100
Wrong Answer
time: 129ms
memory: 6068kb
input:
3215 26 4 13 13 11 13 19 9 2 1 0 17 1 0 2 0 25 15 2 0 0 14 5 1 2 0 20 2 0 2 0 10 21 2 1 0 3 16 0 2 0 8 6 2 1 0 26 24 1 2 0 22 18 0 1 2 7 11 2 0 0 13 4 1 2 0 23 12 0 2 0 18 20 1 2 0 3 5 2 1 0 25 24 1 2 0 7 9 1 2 0 11 14 2 0 0 8 17 1 1 1 23 12 2 0 0 19 26 1 2 0 2 15 0 2 0 4 13 2 1 0 16 10 0 2 0 6 21 0...
output:
Round 1 3 1/3 1/1 1/3 3 1/3 1/1 1/3 0 1/1 1/3 1/1 3 1/3 2/3 1/3 3 1/3 2/3 1/3 0 1/1 1/3 2/3 3 1/3 1/1 1/3 3 1/3 2/3 1/3 0 1/1 1/3 2/3 3 1/3 2/3 1/3 0 1/1 1/3 1/1 3 1/3 1/1 1/3 0 1/1 1/3 2/3 0 1/1 1/3 2/3 0 1/1 1/3 1/1 3 1/3 1/1 1/3 0 1/1 1/3 1/1 3 1/3 5/9 1/3 3 1/3 2/3 1/3 0 1/1 1...
result:
wrong answer 516th lines differ - expected: '0 1/1 1/3 5/9', found: '3 1/3 1/3 5/9 '