1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//Autor: Bartłomiej Czarkowski
#include <bits/stdc++.h>

using namespace std;

const int N = 201'000;
const int M = 3001'000;
int n, m, k, l, ll, zr, uj, a, b;
int kr[M];
int pr[M];
int odw[N];
int zer[N];
vector <int> v[N];
int odp[N];

void zaz(int x) {
	odw[x] = ll;
	for (int i : v[x]) {
		if (odw[kr[i]] < ll && pr[i]) {
			zaz(kr[i]);
		}
	}
}

bool dfs(int x) {
	odw[x] = ll;
	if (x == uj) {
		return true;
	}
	for (int i : v[x]) {
		if (odw[kr[i]] < ll && pr[i]) {
			if (dfs(kr[i])) {
				pr[i] = 0;
				pr[i ^ 1] = 1;
				return true;
			}
		}
	}
	return false;
}

int main() {
	scanf("%d%d%d", &n, &m, &k);
	zr = 0;
	uj = n + n + 1;
	for (int i = 1; i <= n; ++i) {
		kr[l] = i + n;
		pr[l] = 1;
		v[i].push_back(l);
		++l;
		kr[l] = i;
		pr[l] = 0;
		v[i + n].push_back(l);
		++l;
	}
	for (int i = 1; i <= k; ++i) {
		kr[l] = i;
		pr[l] = 1;
		v[zr].push_back(l);
		++l;
		kr[l] = zr;
		pr[l] = 0;
		v[i].push_back(l);
		++l;
	}
	for (int i = k + 1; i <= n; ++i) {
		zer[i] = l;
		kr[l] = uj;
		pr[l] = 1;
		v[i + n].push_back(l);
		++l;
		kr[l] = i + n;
		pr[l] = 0;
		v[uj].push_back(l);
		++l;
	}
	for (int i = 1; i <= m; ++i) {
		scanf("%d%d", &a, &b);
		kr[l] = b;
		pr[l] = 1;
		v[a + n].push_back(l);
		++l;
		kr[l] = a + n;
		pr[l] = 0;
		v[b].push_back(l);
		++l;
	}
	for (int i = k + 1; i <= n; ++i) {
		for (int j = 0; j < l; ++j) {
			pr[j] = 1;
			++j;
			pr[j] = 0;
		}
		for (int j = k + 1; j <= n; ++j) {
			pr[zer[j]] = pr[zer[j] ^ 1] = 0;
		}
		++ll;
		zaz(zr);
		int wyn = 0;
		for (int j = i; j <= n; ++j) {
			pr[zer[j]] = 1;
			if (odw[j + n] == ll) {
				++wyn;
				++ll;
				dfs(zr);
				++ll;
				zaz(zr);
			}
			++odp[wyn];
		}
	}
	for (int i = 0; i <= k; ++i) {
		printf("%d\n", odp[i]);
	}
	return 0;
}