QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#613783 | #9347. Competition in Swiss-system | shmilyc | Compile Error | / | / | C++98 | 3.4kb | 2024-10-05 14:45:00 | 2024-10-05 14:45:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define endl '\n'
struct node
{
ll mp, gp;
ll num_game;
pll mw, gw;
vector<int> oppenent;
node()
{
mp=gp=num_game=0;
mw=gw=make_pair(0,0);
}
};
void reduction(pll &u)
{
auto &[x,y]=u;
ll t=__gcd(x,y);
x/=t, y/=t;
}
pll operator+=(pll &a, const pll &b)
{
pll res;
auto [x1,y1]=a;
auto[x2,y2]=b;
res.second=lcm(y1,y2);
res.first=x1*res.second/y1 + x2*res.second/y2;
reduction(res);
a=res;
// return res;
}
void solve()
{
int n,m;
cin>>n>>m;
vector<node> a(n+1);
int i,j,k;
vector<int> b(m+1);
for(i=1;i<=m;i++)
cin>>b[i];
auto check=[](pll u)
{
auto [x,y]=u;
if(3*x<=y)
x=1, y=3;
return make_pair(x,y);
};
auto fun_omw=[&](node u)->pll
{
if(!u.oppenent.size())
return make_pair(1,3);
int f=0;
pll res;
for(auto idx:u.oppenent)
{
if(!f)
{
f=1;
res=check(a[idx].mw);
continue;
}
res+=check(a[idx].mw);
}
res.second*=u.oppenent.size();
reduction(res);
return res;
};
auto fun_gw=[&](pll u)
{
auto [x,y]=u;
ll t=__gcd(x,y);
x/=t, y/=t;
pll res=make_pair(x,y);
return check(res);
};
auto fun_ogw=[&](node u)->pll
{
if(!u.oppenent.size())
return make_pair(1,3);
int f=0;
pll res;
for(auto idx:u.oppenent)
{
if(!f)
{
f=1;
res=check(a[idx].gw);
continue;
}
res+=check(a[idx].gw);
}
res.second*=u.oppenent.size();
reduction(res);
return res;
};
for(int round=1;round<=m;round++)
{
cout<<"Round "<<round<<endl;
vector<int> vis(n+1);
for(i=0;i<b[round];i++)
{
int p1,p2,w1,w2,d;
cin>>p1>>p2>>w1>>w2>>d;
if(w1>w2) a[p1].mp+=3;
if(w1<w2) a[p2].mp+=3;
if(w1==w2) a[p1].mp++, a[p2].mp++;
a[p1].gp+=w1*3+d, a[p2].gp+=w2*3+d;
a[p1].oppenent.push_back(p2);
a[p2].oppenent.push_back(p1);
a[p1].num_game+=w1+w2+d;
a[p2].num_game+=w1+w2+d;
vis[p1]=vis[p2]=1;
}
for(i=1;i<=n;i++)
{
if(!vis[i])
a[i].mp+=3, a[i].gp+=6, a[i].num_game+=2;
a[i].mw=make_pair(a[i].mp, round*3);
a[i].gw=make_pair(a[i].gp, a[i].num_game*3);
}
for(i=1;i<=n;i++)
{
cout<<a[i].mp<<' '; // mp
pll res_omw=fun_omw(a[i]);
cout<<res_omw.first<<'/'<<res_omw.second<<' '; // omw
pll res_gw=fun_gw(a[i].gw);
cout<<res_gw.first<<'/'<<res_gw.second<<' '; // gw
pll res_ogw=fun_ogw(a[i]);
cout<<res_ogw.first<<'/'<<res_ogw.second; // ogw
cout<<endl;
}
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int T;
cin>>T;
while(T--)
solve();
}
Details
answer.code: In function ‘void reduction(pll&)’: answer.code:22:10: error: expected ‘[’ before ‘&’ token 22 | auto &[x,y]=u; | ^ | [ answer.code:22:10: error: expected identifier before ‘&’ token answer.code:22:9: error: expected ‘]’ before ‘&’ token 22 | auto &[x,y]=u; | ^~ | ] answer.code:23:16: error: ‘x’ was not declared in this scope 23 | ll t=__gcd(x,y); | ^ answer.code:23:18: error: ‘y’ was not declared in this scope 23 | ll t=__gcd(x,y); | ^ answer.code: In function ‘pll operator+=(pll&, const pll&)’: answer.code:30:10: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 30 | auto [x1,y1]=a; | ^ answer.code:30:10: error: ISO C++ forbids declaration of ‘structured binding’ with no type [-fpermissive] 30 | auto [x1,y1]=a; | ^~~~~~~ answer.code:30:10: error: structured binding declaration cannot be C++98 ‘auto’ answer.code:30:10: error: structured binding declaration cannot have type ‘int’ answer.code:30:10: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ answer.code:31:9: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 31 | auto[x2,y2]=b; | ^ answer.code:31:9: error: ISO C++ forbids declaration of ‘structured binding’ with no type [-fpermissive] 31 | auto[x2,y2]=b; | ^~~~~~~ answer.code:31:9: error: structured binding declaration cannot be C++98 ‘auto’ answer.code:31:9: error: structured binding declaration cannot have type ‘int’ answer.code:31:9: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ answer.code:32:16: error: ‘lcm’ was not declared in this scope 32 | res.second=lcm(y1,y2); | ^~~ answer.code:37:1: warning: no return statement in function returning non-void [-Wreturn-type] 37 | } | ^ answer.code: In function ‘void solve()’: answer.code:49:10: error: ‘check’ does not name a type 49 | auto check=[](pll u) | ^~~~~ answer.code:57:10: error: ‘fun_omw’ does not name a type 57 | auto fun_omw=[&](node u)->pll | ^~~~~~~ answer.code:77:10: error: ‘fun_gw’ does not name a type 77 | auto fun_gw=[&](pll u) | ^~~~~~ answer.code:85:10: error: ‘fun_ogw’ does not name a type 85 | auto fun_ogw=[&](node u)->pll | ^~~~~~~ answer.code:137:25: error: ‘fun_omw’ was not declared in this scope 137 | pll res_omw=fun_omw(a[i]); | ^~~~~~~ answer.code:140:24: error: ‘fun_gw’ was not declared in this scope 140 | pll res_gw=fun_gw(a[i].gw); | ^~~~~~ answer.code:143:25: error: ‘fun_ogw’ was not declared in this scope 143 | pll res_ogw=fun_ogw(a[i]); | ^~~~~~~