From a3dd2581ed4847670f81157091016c14ca18803d Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Tue, 14 Jan 2020 18:29:11 +0700 Subject: [usth/MATH2.3] Mathemate Discretely --- usth/MATH2.3/2/incidentmat2edges.cc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 usth/MATH2.3/2/incidentmat2edges.cc (limited to 'usth/MATH2.3/2/incidentmat2edges.cc') diff --git a/usth/MATH2.3/2/incidentmat2edges.cc b/usth/MATH2.3/2/incidentmat2edges.cc new file mode 100644 index 0000000..2fe5d79 --- /dev/null +++ b/usth/MATH2.3/2/incidentmat2edges.cc @@ -0,0 +1,33 @@ +#include +#include +#include + +using namespace std; + +int +main () +{ + int v, e, b; + map, int> m; + + cin >> v >> e; + for (int i = 0; i < v; ++i) + { + pair p {-1, -1}; + + for (int j = 0; j < e; ++j) + { + cin >> b; + if (!b) + continue; + if (p.first < 0) + p.first = p.second = j; + else + p.second = j; + } + m[p]++; + } + + for (auto const& [p, c] : m) + cout << p.first << " " << p.second << " " << c << endl; +} -- cgit 1.4.1