3621 | 2023-03-01 11:28:05 | Error42 | Emezen Rt. | cpp17 | Wrong answer 0/100 | 93ms | 43940 KiB |
#include <iostream>
#include <vector>
using namespace std;
int main()
{
cin.tie(nullptr);
cout.tie(nullptr);
ios_base::sync_with_stdio(false);
int t;
cin>>t;
while(t--)
{
int db=0;
int n,m;
cin>>n>>m;
vector<int> state(n+1,0);//1=bolt 2=raktár
vector<vector<int>>vec(n+1, vector<int>(0, 0));
for(size_t i = 0;i<m;i++)
{
int u,v;
cin>>u>>v;
vec[u].push_back(v);
vec[v].push_back(u);
}
for(int i=1;i<=n;i++)
{
int b=0;
int r=0;
for(auto j : vec[i])
{
if(state[j]==1)
{
b++;
}
else if(state[j]==2)
{
r++;
}
}
if(b>r)
{
state[i]=2;
db++;
}
if(b<r)
{
state[i]=1;
}
if(b==r)
{
state[i]=2;
db++;
}
}
cout<<db<<"\n";
for (size_t i = 1; i <= m; i++)
{
if(state[i]==2)
{
cout<<i<<" ";
}
}
cout<<"\n";
}
return 0;
}
/*
2
4 5
1 2
1 3
1 4
2 3
3 4
5 5
1 2
2 3
3 4
4 5
5 1
*/
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1828 KiB | ||||
subtask2 | 0/16 | ||||||
2 | Accepted | 3ms | 2184 KiB | ||||
3 | Accepted | 3ms | 2300 KiB | ||||
4 | Accepted | 3ms | 2640 KiB | ||||
5 | Accepted | 3ms | 2604 KiB | ||||
6 | Accepted | 3ms | 2736 KiB | ||||
7 | Accepted | 3ms | 2828 KiB | ||||
8 | Accepted | 3ms | 2824 KiB | ||||
9 | Accepted | 3ms | 2952 KiB | ||||
10 | Accepted | 3ms | 3160 KiB | ||||
11 | Wrong answer | 3ms | 3252 KiB | ||||
12 | Wrong answer | 3ms | 3380 KiB | ||||
13 | Wrong answer | 3ms | 3724 KiB | ||||
14 | Accepted | 3ms | 3840 KiB | ||||
15 | Accepted | 3ms | 3904 KiB | ||||
16 | Accepted | 3ms | 3688 KiB | ||||
subtask3 | 0/18 | ||||||
17 | Wrong answer | 21ms | 6972 KiB | ||||
18 | Wrong answer | 43ms | 12300 KiB | ||||
19 | Wrong answer | 43ms | 12796 KiB | ||||
20 | Accepted | 8ms | 13836 KiB | ||||
21 | Accepted | 48ms | 20420 KiB | ||||
22 | Runtime error | 61ms | 23884 KiB | ||||
23 | Runtime error | 71ms | 23332 KiB | ||||
24 | Runtime error | 68ms | 27288 KiB | ||||
25 | Runtime error | 81ms | 31580 KiB | ||||
26 | Runtime error | 75ms | 33764 KiB | ||||
subtask4 | 0/66 | ||||||
27 | Wrong answer | 8ms | 26340 KiB | ||||
28 | Wrong answer | 16ms | 27952 KiB | ||||
29 | Accepted | 29ms | 30516 KiB | ||||
30 | Runtime error | 71ms | 35260 KiB | ||||
31 | Runtime error | 92ms | 38912 KiB | ||||
32 | Runtime error | 93ms | 41208 KiB | ||||
33 | Runtime error | 90ms | 42584 KiB | ||||
34 | Runtime error | 86ms | 43940 KiB | ||||
35 | Wrong answer | 48ms | 39120 KiB | ||||
36 | Wrong answer | 48ms | 40916 KiB | ||||
37 | Wrong answer | 3ms | 35752 KiB | ||||
38 | Accepted | 4ms | 36164 KiB | ||||
39 | Wrong answer | 8ms | 36992 KiB | ||||
40 | Wrong answer | 3ms | 36424 KiB | ||||
41 | Wrong answer | 3ms | 36400 KiB | ||||
42 | Accepted | 48ms | 36944 KiB | ||||
43 | Wrong answer | 21ms | 37308 KiB | ||||
44 | Wrong answer | 4ms | 37208 KiB | ||||
45 | Wrong answer | 3ms | 37416 KiB |