답안 #217154

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
217154 2020-03-29T07:01:13 Z fedoseevtimofey 조이터에서 친구를 만드는건 재밌어 (JOI20_joitter2) C++14
0 / 100
5 ms 384 KB
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n, m;
  cin >> n >> m;
  vector <vector <int>> g(n, vector <int> (n));
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u][v] = 1;
    for (int x = 0; x < n; ++x) {
      for (int y = 0; y < n; ++y) {
        for (int z = 0; z < n; ++z) {
          if (x != y && x != z && y != z && g[x][y] && g[y][z] && g[z][y]) {
            g[x][z] = 1;
          }
        }
      }
    } 
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (g[i][j]) {
          ++cnt;
        }
      }
    }
    cout << cnt << '\n';
  }
}

# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -