QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#674500 | #9102. Zayin and Elements | ucup-team5071# | Compile Error | / | / | C++20 | 2.2kb | 2024-10-25 16:09:05 | 2024-10-25 16:09:06 |
Judging History
answer
include<bits/stdc++.h>
using namespace std;
const int N=205,M=3005;
struct SSP{
int cnt=1,hd[N],nxt[M<<1],to[M<<1],limit[M<<1],cst[M<<1];
void init(){
memset(hd,0,sizeof(hd));
cnt=1;
}
void add(int u,int v,int w,int c){
//cout<<u<<" "<<v<<" "<<w<<" "<<c<<endl;
nxt[++cnt]=hd[u],hd[u]=cnt,to[cnt]=v,limit[cnt]=w,cst[cnt]=c;
nxt[++cnt]=hd[v],hd[v]=cnt,to[cnt]=u,limit[cnt]=0,cst[cnt]=-c;
}
int fr[N],fl[N],in[N],dis[N];
pair<int,int> min_cost(int s,int t){
int flow=0,cost=0;
while(true){
queue<int> q;
memset(dis,0x3f,sizeof(dis));
memset(in,0,sizeof(in));
fl[s]=1e9,dis[s]=0,q.push(s);
while(!q.empty()){
int cur=q.front();
q.pop();in[cur]=0;
for(int i=hd[cur];i;i=nxt[i]){
int it=to[i],d=dis[cur]+cst[i];
// cout<<"i="<<i<<" it="<<it<<endl;
if(limit[i]&&d<dis[it]){
fl[it]=min(limit[i],fl[cur]),fr[it]=i,dis[it]=d;
if(!in[it])in[it]=1,q.push(it);
}
}
}
if(dis[t]>1e9)return {flow,cost};
flow+=fl[t],cost+=dis[t]*fl[t];
for(int u=t;u!=s;u=to[fr[u]^1])limit[fr[u]]-=fl[t],limit[fr[u]^1]+=fl[t];
}
}
}Sol;
void Solve(){
int n,m;
cin>>n>>m;
Sol.init();
int s=m*2+n+1,t=m*2+n+2;
int res=0;
for(int i=1;i<=n;i++)
Sol.add(2*m+i,t,1,0);
for(int i=1;i<=m;i++){
int a,b,c,t;
cin>>a>>b>>c>>t;
Sol.add(s,i,(int)1e9,0);
res+=(b+c);
Sol.add(i,i+m,a,0);
for(int j=1;j<=b;j++)
Sol.add(i,i+m,2,1);
for(int j=1;j<=c;j++)
Sol.add(i,i+m,1,1);
for(int j=1;j<=t;j++){
int x;
cin>>x;
Sol.add(i+m,2*m+x,1,0);
}
}
pair<int,int> now=Sol.min_cost(s,t);
if(now.first<n)cout<<"-1"<<"\n";
else cout<<(res-now.second)<<"\n";
}
int main(){
//ios::sync_with_stdio(false),cin.tie(0);
int T;
cin>>T;
while(T--)Solve();
return 0;
}
Details
answer.code:1:9: error: ‘bits’ was not declared in this scope 1 | include<bits/stdc++.h> | ^~~~ answer.code:1:14: error: ‘stdc’ was not declared in this scope; did you mean ‘std’? 1 | include<bits/stdc++.h> | ^~~~ | std answer.code:1:9: error: ‘bits’ was not declared in this scope 1 | include<bits/stdc++.h> | ^~~~ answer.code:1:14: error: ‘stdc’ was not declared in this scope; did you mean ‘std’? 1 | include<bits/stdc++.h> | ^~~~ | std answer.code:1:9: error: ‘bits’ was not declared in this scope 1 | include<bits/stdc++.h> | ^~~~ answer.code:1:14: error: ‘stdc’ was not declared in this scope; did you mean ‘std’? 1 | include<bits/stdc++.h> | ^~~~ | std answer.code:1:9: error: ‘bits’ was not declared in this scope 1 | include<bits/stdc++.h> | ^~~~ answer.code:1:14: error: ‘stdc’ was not declared in this scope; did you mean ‘std’? 1 | include<bits/stdc++.h> | ^~~~ | std answer.code:1:9: error: ‘bits’ was not declared in this scope 1 | include<bits/stdc++.h> | ^~~~ answer.code:1:14: error: ‘stdc’ was not declared in this scope; did you mean ‘std’? 1 | include<bits/stdc++.h> | ^~~~ | std answer.code:1:9: error: ‘bits’ was not declared in this scope 1 | include<bits/stdc++.h> | ^~~~ answer.code:1:14: error: ‘stdc’ was not declared in this scope; did you mean ‘std’? 1 | include<bits/stdc++.h> | ^~~~ | std answer.code:1:9: error: ‘bits’ was not declared in this scope 1 | include<bits/stdc++.h> | ^~~~ answer.code:1:14: error: ‘stdc’ was not declared in this scope; did you mean ‘std’? 1 | include<bits/stdc++.h> | ^~~~ | std answer.code:1:9: error: ‘bits’ was not declared in this scope 1 | include<bits/stdc++.h> | ^~~~ answer.code:1:14: error: ‘stdc’ was not declared in this scope; did you mean ‘std’? 1 | include<bits/stdc++.h> | ^~~~ | std answer.code:1:9: error: ‘bits’ was not declared in this scope 1 | include<bits/stdc++.h> | ^~~~ answer.code:1:14: error: ‘stdc’ was not declared in this scope; did you mean ‘std’? 1 | include<bits/stdc++.h> | ^~~~ | std answer.code:1:1: error: ‘include’ does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ answer.code:16:5: error: ‘pair’ does not name a type 16 | pair<int,int> min_cost(int s,int t){ | ^~~~ answer.code: In member function ‘void SSP::init()’: answer.code:7:9: error: ‘memset’ was not declared in this scope 7 | memset(hd,0,sizeof(hd)); | ^~~~~~ answer.code:1:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? +++ |+#include <cstring> 1 | include<bits/stdc++.h> answer.code: In function ‘void Solve()’: answer.code:43:5: error: ‘cin’ was not declared in this scope 43 | cin>>n>>m; | ^~~ answer.code:65:5: error: ‘pair’ was not declared in this scope 65 | pair<int,int> now=Sol.min_cost(s,t); | ^~~~ answer.code:65:10: error: expected primary-expression before ‘int’ 65 | pair<int,int> now=Sol.min_cost(s,t); | ^~~ answer.code:66:8: error: ‘now’ was not declared in this scope 66 | if(now.first<n)cout<<"-1"<<"\n"; | ^~~ answer.code:66:20: error: ‘cout’ was not declared in this scope 66 | if(now.first<n)cout<<"-1"<<"\n"; | ^~~~ answer.code:67:10: error: ‘cout’ was not declared in this scope 67 | else cout<<(res-now.second)<<"\n"; | ^~~~ answer.code: In function ‘int main()’: answer.code:72:5: error: ‘cin’ was not declared in this scope 72 | cin>>T; | ^~~