QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623902#7995. 图JYYMVPCompile Error//C++141021b2024-10-09 14:20:332024-10-09 14:20:47

Judging History

你现在查看的是最新测评结果

  • [2024-10-09 14:20:47]
  • 评测
  • [2024-10-09 14:20:33]
  • 提交

answer

#include <unordered_map>
#include <unordered_set>
#define ll long long
#define abs(a) (a > 0 ? (a) : -(a))
static ll max(ll a, ll b) { return a > b ? a : b; }
static ll min(ll a, ll b) { return a < b ? a : b; }
using namespace std;

const int N = 1e5 + 9;


int f[509][509];
int g[509][509];


int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            cin >> f[i][j];
            g[i][j] = f[i][j];
        }
    }

    for (int k = 1; k <= n; k++) {
        for (int x = 1; x <= n; x++) {
            for (int y = 1; y <= n; y++) {
                f[x][y] = min(f[x][y], f[x][k] + f[k][y]);
            }
        }
    }


    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (i == j) cout << "0";
            else {
                if (f[i][j] == g[i][j]) cout << "1";
                else cout << "0";
            }
        }
        cout << endl;
    }

    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:18:5: error: ‘cin’ was not declared in this scope
   18 |     cin >> n;
      |     ^~~
answer.code:3:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
    2 | #include <unordered_set>
  +++ |+#include <iostream>
    3 | #define ll long long
answer.code:37:25: error: ‘cout’ was not declared in this scope
   37 |             if (i == j) cout << "0";
      |                         ^~~~
answer.code:37:25: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code:39:41: error: ‘cout’ was not declared in this scope
   39 |                 if (f[i][j] == g[i][j]) cout << "1";
      |                                         ^~~~
answer.code:39:41: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code:40:22: error: ‘cout’ was not declared in this scope
   40 |                 else cout << "0";
      |                      ^~~~
answer.code:40:22: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code:43:9: error: ‘cout’ was not declared in this scope
   43 |         cout << endl;
      |         ^~~~
answer.code:43:9: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code:43:17: error: ‘endl’ was not declared in this scope
   43 |         cout << endl;
      |                 ^~~~
answer.code:3:1: note: ‘std::endl’ is defined in header ‘<ostream>’; did you forget to ‘#include <ostream>’?
    2 | #include <unordered_set>
  +++ |+#include <ostream>
    3 | #define ll long long