Submission #569107

#TimeUsernameProblemLanguageResultExecution timeMemory
569107SSRSDuathlon (APIO18_duathlon)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<int>> E(n);
  for (int i = 0; i < m; i++){
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    E[u].push_back(v);
    E[v].push_back(u);
  }
  int ans = 0;
  for (int c = 0; c < n; c++){
    vector<vector<bool>> ok(n, vector<bool>(n, true));
    for (int u = 0; u < n; u++){
      if (u != c){
        vector<bool> used(n, false);
        used[c] = true;
        queue<int> Q;
        Q.push(c);
        while (!Q.empty()){
          int v = Q.front();
          Q.pop();
          for (int w : E[v]){
            if (!used[w] && w != u){
              used[w] = true;
              Q.push(w);
            }
          }
        }
        for (int s = 0; s < n; s++){
          for (int f = 0; f < n; f++){
            if (!used[s] && !used[f]){
              ok[s][f] = false;
            }
          }
        }
      }
    }
    for (int s = 0; s < n; s++){
      for (int f = 0; f < n; f++){
        if (s != c && f != c && s != f && ok[s][f]){[
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

Compilation message (stderr)

count_triplets.cpp: In function 'int main()':
count_triplets.cpp:46:14: error: expected ',' before '++' token
   46 |           ans++;
      |              ^~
      |              ,
count_triplets.cpp:46:14: error: expected identifier before '++' token
   46 |           ans++;
      |              ^~
count_triplets.cpp:46:16: error: expected ']' before ';' token
   46 |           ans++;
      |                ^
      |                ]
count_triplets.cpp: In lambda function:
count_triplets.cpp:46:16: error: expected '{' before ';' token