QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#581647 | #2517. Critical Structures | CSQ# | Compile Error | / | / | C++14 | 2.2kb | 2024-09-22 13:45:19 | 2024-09-22 13:45:19 |
Judging History
This is the latest submission verdict.
- [2024-09-22 13:45:19]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-09-22 13:45:19]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define all(x) begin(x),end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
int bridge = 0,cut = 0;
vi num, st;
vector<vector<pii>> ed;
int Time;
int dfs(int at, int par, vector<vector<int>> &f){
int me = num[at] = ++Time, e, y, top = me;
int cnt = 0;
for (auto pa : ed[at]) if (pa.second != par){
tie(y, e) = pa;
if (num[y]){
top = min(top, num[y]);
if (num[y] < me)
st.push_back(e);
}
else {
int si = sz(st);
int up = dfs(y, e, f);
top = min(top, up);
if(up >= me){
//cout<<at<<" "<<y<<'\n';
cnt++;
if(par != -1)cut++;
else if(cnt>1)cut++;
}
if (up == me){
st.push_back(e);
f.push_back(vi(st.begin() + si, st.end()));
st.resize(si);
}
else if (up < me) st.push_back(e);
else { bridge++;}
}
}
return top;
}
int main()
{
int t;
cin>>t;
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
while(t--){
bridge = cut = Time = 0;
st.clear();
num.clear();
int n,m;
cin>>n>>m;
int eid = 0;
ed.resize(n);
for(int i=0;i<n;i++)ed[i].clear();
vector<array<int,2>>ee;
for(int i=0;i<m;i++){
int a,b;
cin>>a>>b;
a--;
b--;
ee.push_back({a,b});
ed[a].push_back({b,eid});
ed[b].push_back({a,eid++});
}
vector<vector<int>>v;
num.assign(sz(ed),0);
for(int i=0;i<sz(ed);i++)if(!num[i])dfs(i,-1,v);
vector<int>seen(n,0);
int mx = 0;
for(auto x:v){
mx = max(mx,sz(x));
}
int comp = sz(v);
comp += bridge;
int g = gcd(comp,mx);
comp/=g;
mx/=g;
cout<<cut<<" "<<bridge<<" "<<comp<<" "<<mx<<'\n';
}
return 0;
}
详细
answer.code: In function ‘int main()’: answer.code:82:17: error: ‘gcd’ was not declared in this scope 82 | int g = gcd(comp,mx); | ^~~