Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define NMAX 103
- int n, m;
- bool adjm[NMAX][NMAX];
- int d[NMAX][2];
- void read() {
- cin >> n >> m;
- for (int i = 0; i < m; i++) {
- int a, b;
- cin >> a >> b;
- adjm[a][b] = true;
- }
- }
- void solve() {
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= n; j++) {
- if (adjm[i][j]) {
- d[i][0]++;
- d[j][1]++;
- }
- }
- }
- }
- void write() {
- for (int sign = 0; sign < 2; sign++) {
- for (int i = 1; i <= n; i++) {
- cout << 'd' << (sign ? '-' : '+') << '(' << i << ")=" << d[i][sign] << endl;
- }
- }
- }
- int main() {
- read();
- solve();
- write();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement