QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#720184 | #4580. Bicycle Tour | Mansa_Kimoyo | WA | 1ms | 5992kb | C++14 | 1.2kb | 2024-11-07 11:08:24 | 2024-11-07 11:08:24 |
Judging History
answer
#include<bits/stdc++.h>
#define pb push_back
#define fir first
#define sec second
#define pii pair<int,int>
#define umap unordered_map
#define ins insert
using namespace std;
const int N=1e5+5;
int n,m;
int a[N],deg[N];
vector<pii> g[N];
namespace Sub1{
int used[N];
inline void Main(){
queue<int> q;
int ans=0;
for(int i=1;i<=n;++i)
if(deg[i]==1) q.push(i);
while(!q.empty()){
int x=q.front();q.pop();
used[x]=1;
for(pii p:g[x]){
int v=p.fir;
--deg[v];
if(deg[v]==1) q.push(v);
}
}
for(int i=1;i<=n;++i){
for(pii p:g[i]){
int v=p.fir,w=p.sec;
if(!used[i] && !used[v])
ans=max(ans,w);
}
}
for(int i=1;i<=n;++i){
if(!used[i]) cout<<ans<<' ';
else cout<<"-1 ";
}
exit(0);
}
}
namespace Sub2{
inline void Main(){
exit(0);
}
}
signed main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
// freopen("cycle.in","r",stdin);
// freopen("cycle.out","w",stdout);
cin>>n>>m;
for(int i=1;i<=n;++i) cin>>a[i];
for(int i=1;i<=m;++i){
int u,v;cin>>u>>v;
g[u].pb({v,abs(a[u]-a[v])});
g[v].pb({u,abs(a[u]-a[v])});
deg[u]++,deg[v]++;
}
if(n==m) Sub1::Main();
Sub2::Main();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5992kb
input:
8 11 5 2 7 0 10 6 6 6 1 2 1 3 2 3 2 4 2 5 2 7 3 5 1 6 6 7 6 8 7 8
output:
result:
wrong answer 1st lines differ - expected: '4 4 5 -1 8 0 0 0', found: ''