QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#734436#8591. Shopsluqyou0 179ms11544kbC++141.2kb2024-11-11 10:34:532024-11-11 10:34:53

Judging History

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

  • [2024-11-11 10:34:53]
  • 评测
  • 测评结果:0
  • 用时:179ms
  • 内存:11544kb
  • [2024-11-11 10:34:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define sc second
#define pii pair<int,int>
#define pb push_back
#define umap unordered_map
#define mset multiset
#define pq priority_queue
#define ull unsigned long long
#define i128 __int128
const int maxn=5e5+10;
int n,m,vis[maxn],col[maxn];
pii minn[maxn];
void dfs(int u){
    vis[u]=1;
    if(!vis[minn[u].sc]){
        col[minn[u].sc]=(!col[u]);
        dfs(minn[u].sc);
    }
}
void solve(){
    cin>>n>>m;
    for(int i=1;i<=n;i++) minn[i]={1e9,0};
    for(int i=1,u,v,w;i<=m;i++){
        cin>>u>>v>>w;
        minn[u]=min(minn[u],{w,v});
        minn[v]=min(minn[v],{w,u});
    }
    for(int i=1;i<=n;i++) cout<<minn[i].fi<<" "<<minn[i].sc<<endl;
    for(int i=1;i<=n;i++) if(!vis[i]) dfs(i);
    cout<<(*max_element(minn+1,minn+n+1)).fi<<endl;
    for(int i=1;i<=n;i++) cout<<(col[i]?"B":"D");
    cout<<endl;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}
/*
Samples
input:

output:

THINGS TODO:
检查freopen,尤其是后缀名
检查空间
检查调试语句是否全部注释
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3684kb

input:

3 3
1 2 3
2 3 1
1 3 2

output:

2 3
1 3
1 2
2
DDB

result:

wrong answer Token "3" doesn't correspond to pattern "[BD]*"

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 179ms
memory: 11544kb

input:

500000 499999
1 2 776715136
2 3 406881694
3 4 265792290
4 5 507607272
5 6 182246639
6 7 997847597
7 8 164130256
8 9 278962226
9 10 411194641
10 11 363646402
11 12 672225656
12 13 494629089
13 14 717664153
14 15 121619271
15 16 476857704
16 17 301215244
17 18 810217743
18 19 850722975
19 20 10710274
...

output:

776715136 2
406881694 3
265792290 4
265792290 3
182246639 6
182246639 5
164130256 8
164130256 7
278962226 8
363646402 11
363646402 10
494629089 13
494629089 12
121619271 15
121619271 14
301215244 17
301215244 16
810217743 17
10710274 20
10710274 19
407482703 22
358639389 23
30461498 24
30461498 23
1...

result:

wrong answer Token "2" doesn't correspond to pattern "[BD]*"

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 144ms
memory: 10380kb

input:

366489 397001
2 127909 1
7 171229 1
8 158597 1
11 282213 1
14 356007 1
15 286102 1
16 93205 1
17 260111 1
18 138962 1
20 359938 1
29 223905 1
31 357684 1
32 259968 1
34 65205 1
37 200276 1
41 83195 1
43 159858 1
48 332277 1
50 320322 1
51 338467 1
53 262785 1
55 83815 1
56 173198 1
58 169473 1
63 19...

output:

1 102205
1 127909
1 163194
1 112563
1 23142
1 235075
1 171229
1 158597
1 121682
1 87923
1 282213
1 70446
1 100651
1 356007
1 286102
1 93205
1 260111
1 138962
1 188194
1 338566
1 143696
1 37345
1 104559
1 178290
1 99580
1 47543
1 50230
1 20446
1 223905
1 7825
1 279363
1 259968
1 22475
1 65205
1 46671...

result:

wrong answer Token "102205" doesn't correspond to pattern "[BD]*"

Subtask #5:

score: 0
Skipped

Dependency #1:

0%