QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#341738#995. 桥jucason_xu#WA 80ms32020kbC++141.2kb2024-02-29 20:54:282024-02-29 20:54:28

Judging History

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

  • [2024-02-29 20:54:28]
  • 评测
  • 测评结果:WA
  • 用时:80ms
  • 内存:32020kb
  • [2024-02-29 20:54:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rd(i,n) for(int i=0;i<n;i++)
#define rp(i,n) for(int i=1;i<=n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
#define st string
#define vt vector
#define pb push_back
//#define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N=500005;
int n,m,a[N],b[N],c;
int dfn[N],low[N],ti;
vt<pii>G[N];
vt<int>ans;
inline void dfs(int x,int p){
    dfn[x]=low[x]=++ti;
    for(auto i:G[x])if(i.second!=p){
        if(!dfn[i.first]){
            dfs(i.first,i.second);
            low[x]=min(low[x],low[i.first]);
            if(dfn[i.first]==low[i.first]){
                ans.pb(i.second);
            }
        }else{
            low[x]=min(low[x],dfn[i.first]);
        }
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    rp(i,m){
        cin>>a[i]>>b[i];
        G[a[i]].pb({b[i],i});
        G[b[i]].pb({a[i],i});
    }
    dfs(1,0);
    for(auto i:ans){
        cout<<a[i]<<" "<<b[i]<<endl;
    }

    return 0;
}
//Rain Rain Rain

详细

Test #1:

score: 100
Accepted
time: 80ms
memory: 32020kb

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:


result:

ok 0 lines

Test #2:

score: 0
Accepted
time: 19ms
memory: 23880kb

input:

10599 87159
4698 4000
60 4705
1476 5947
7273 1716
8004 3018
10094 1717
3092 3493
2613 9681
5427 3723
2510 6343
10113 6322
9257 634
4996 10197
9918 5582
6348 9561
10536 9777
8133 540
1917 7838
6666 2220
7951 815
2873 977
9397 4991
3529 1395
1426 3874
6379 9098
9504 3437
9076 9134
4321 3879
10252 9390...

output:


result:

ok 0 lines

Test #3:

score: -100
Wrong Answer
time: 38ms
memory: 26824kb

input:

43236 126833
40500 20695
21481 27642
28098 41772
412 7750
5862 39561
21777 22303
7868 21217
31658 34299
18532 10934
21931 31023
42926 15624
40332 18017
12484 8663
21927 7910
12504 17943
4379 10252
3523 21794
18641 1965
18633 25061
14639 10800
35958 1441
35044 20249
31491 38161
5749 4468
13403 8413
3...

output:

15572 4970
21464 4970
25633 32446
1349 20915
11392 15640
2276 35627
1592 7049
35388 534
14371 5904
33548 29449
17419 11651
33667 3082
38163 14753
6157 19375
13811 35147
2730 10595
28270 14602
15960 31348
2598 28166
26942 20687
27627 28062
41740 5931
12899 16125
38008 17235
23821 32416
15042 22962
30...

result:

wrong answer 1st lines differ - expected: '1349 20915', found: '15572 4970'