fork download
  1. class BuildingRoutes {
  2. public:
  3. int build(vector <string> d, int T) {
  4. int dist[50][50], n = d.size();
  5. for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j)
  6. dist[i][j] = d[i][j] - '0';
  7. int sp[50][50];
  8. for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j)
  9. sp[i][j] = dist[i][j];
  10. for (int k = 0; k < n; ++k)
  11. for (int i = 0; i < n; ++i)
  12. for (int j = 0; j < n; ++j)
  13. if (sp[i][k] + sp[k][j] < sp[i][j])
  14. sp[i][j] = sp[i][k] + sp[k][j];
  15.  
  16. int Count[50][50] = {{0}};
  17. for (int i = 0; i < n; ++i) {
  18. for (int j = 0; j < n; ++j) {
  19. if (i == j) continue;
  20. for (int k = 0; k < n; ++k)
  21. for (int l = 0; l < n; ++l) {
  22. if (k == l) continue;
  23. if (sp[i][k] + dist[k][l] + sp[l][j] == sp[i][j])
  24. ++Count[k][l];
  25. }
  26. }
  27. }
  28. int res = 0;
  29. for (int i = 0; i < n; ++i)
  30. for (int j = 0; j < n; ++j)
  31. if (i != j && Count[i][j] >= T)
  32. res += dist[i][j];
  33. return res;
  34. }
  35. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:12: error: ‘vector’ has not been declared
  int build(vector <string> d, int T) {
            ^
prog.cpp:3:19: error: expected ‘,’ or ‘...’ before ‘<’ token
  int build(vector <string> d, int T) {
                   ^
prog.cpp: In member function ‘int BuildingRoutes::build(int)’:
prog.cpp:4:25: error: ‘d’ was not declared in this scope
   int dist[50][50], n = d.size();
                         ^
prog.cpp:31:34: error: ‘T’ was not declared in this scope
     if (i != j && Count[i][j] >= T)
                                  ^
stdout
Standard output is empty