QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#218492 | #2017. 排水系统 | PlentyOfPenalty | Compile Error | / | / | C++20 | 908b | 2023-10-18 13:43:44 | 2023-10-18 13:43:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using lll=__int128;
const int N=1e5+9;
int n,m,deg[N];
vector<int> G[N];
struct frac{
lll x,y;
frac(lll x,lll y):x(x),y(y){
lll g=__gcd(x,y);
x/=g,y/=g;
}
friend frac operator+(const frac &a,const frac &b){
lll g=__gcd(a.y,b.y);
lll y=a.y/g*b.y;
return frac(y/a.y*a.x+y/b.y*b.x,y);
}
friend frac operator*(const frac &a,const frac &b){
return frac(a.x*b.x,a.y*b.y);
}
}f[N];
int main(){
#ifdef memset0
freopen("A.in","r",stdin);
#endif
cin.tie(0)->sync_with_stdio(0);
cin>>n>>m;
for(int k,i=1;i<=n;i++){
cin>>k;
a[i].resize(k);
for(int &x:a[i]){
cin>>x;
deg[x]++;
}
}
queue<int> q;
for(int i=1;i<=n;i++)
if(!deg[i]){
q.push(i);
}
while(q.size()){
int u=q.front();
q.pop();
frac t(f[u].x,f[u].y*G[u].size());
for(int v:G[u]){
--deg[v];
f[v]+=t;
}
}
}
Details
answer.code:21:5: error: no matching function for call to ‘frac::frac()’ 21 | }f[N]; | ^ answer.code:9:9: note: candidate: ‘frac::frac(lll, lll)’ 9 | frac(lll x,lll y):x(x),y(y){ | ^~~~ answer.code:9:9: note: candidate expects 2 arguments, 0 provided answer.code:7:8: note: candidate: ‘constexpr frac::frac(const frac&)’ 7 | struct frac{ | ^~~~ answer.code:7:8: note: candidate expects 1 argument, 0 provided answer.code:7:8: note: candidate: ‘constexpr frac::frac(frac&&)’ answer.code:7:8: note: candidate expects 1 argument, 0 provided answer.code: In function ‘int main()’: answer.code:30:17: error: ‘a’ was not declared in this scope 30 | a[i].resize(k); | ^ answer.code:47:29: error: no match for ‘operator+=’ (operand types are ‘frac’ and ‘frac’) 47 | f[v]+=t; | ~~~~^~~