Код: Выделить всё
solved
Вот мой код, но это не так. работает как задумано:
Код: Выделить всё
#include
using namespace std;
typedef long double ld;
#define int long long
#define pb push_back
#define all(x) x.begin(), x.end()
const int N = 105;
vector graph[N];
vector color(N);
bool unused[5];
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
for(int i = 0; i < m; i++){
int x, y;
cin >> x >> y;
graph[x].pb(y);
graph[y].pb(x);
}
color[1] = 1;
for(int i = 2; i
Источник: [url]https://stackoverflow.com/questions/78145189/why-is-my-graph-coloring-code-not-coloring-the-graph-correctly[/url]