QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#253820#995. 桥CharlieVinnieWA 44ms11568kbC++171.3kb2023-11-17 16:28:482023-11-17 16:28:49

Judging History

你现在查看的是最新测评结果

  • [2023-11-17 16:28:49]
  • 评测
  • 测评结果:WA
  • 用时:44ms
  • 内存:11568kb
  • [2023-11-17 16:28:48]
  • 提交

answer

#include "bits/stdc++.h"
#ifdef DEBUG
#include "PrettyDebug.hpp"
#else
#define debug(...) [](auto...){}(__VA_ARGS__)
#define debuga(...) [](auto...){}(__VA_ARGS__)
#endif
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
using namespace std; typedef long long ll;
constexpr int N=1e5+5;
int n,m,a[N],b[N],dfn[N],low[N],dfscnt; vector<pair<int,int>> to[N]; vector<int> ans;
void dfs(int u,int fr){
    dfn[u]=low[u]=++dfscnt;
    for(auto [v,e]:to[u]) if(e!=fr){
        if(!dfn[v]){
            dfs(v,e),low[u]=min(low[u],low[v]);
            if(low[v]>dfn[u]) ans.push_back(e);
        }
        else{
            low[u]=min(low[u],dfn[v]);
        }
    }
}
signed main(){
    atexit([](){cerr<<"Time = "<<clock()<<" ms"<<endl;});
    cin>>n>>m; For(i,1,m) { int x,y; cin>>x>>y; to[x].emplace_back(y,i); to[y].emplace_back(x,i); a[i]=x,b[i]=y; }
    For(i,1,n) if(!dfn[i]) dfs(i,0);
    sort(ans.begin(),ans.end()); for(int e:ans) cout<<a[e]<<' '<<b[e]<<'\n';
    return 0;
}

// START TYPING IF YOU DON'T KNOW WHAT TO DO
// STOP TYPING IF YOU DON'T KNOW WHAT YOU'RE DOING
// CONTINUE, NON-STOPPING, FOR CHARLIEVINNIE

// Started Coding On: November 17 Fri, 16 : 17 : 11

詳細信息

Test #1:

score: 0
Wrong Answer
time: 44ms
memory: 11568kb

input:

24942 387166
12556 21443
22404 16376
11073 24296
1535 11968
23745 2818
5073 12731
22550 14761
24118 12008
22695 18979
15118 13639
2080 8721
692 22578
22581 15267
9278 4127
7457 21674
17693 23448
10949 23429
9700 6009
14140 5064
7742 15164
17336 1662
18903 9760
17645 19575
6540 11942
11 4937
15282 10...

output:

23086 9796
11649 13969
15710 11305
17825 4536
24043 4070
11329 8017
11641 11818
23345 12685
975 14740
11747 13836
1074 21620
20267 8205
22847 10889
9139 22269
1699 12538
13455 4023
20163 19675
9864 22577
5976 23604
6840 10630
19614 5659
5066 5266
17235 21229
10257 10601
14125 10693
22861 24765
972 2...

result:

wrong output format Extra information in the output file