QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#645902#7042. So EasySGColinCompile Error//Python3667b2024-10-16 20:25:012024-10-16 20:25:07

Judging History

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

  • [2024-10-16 20:25:07]
  • 评测
  • [2024-10-16 20:25:01]
  • 提交

answer

#include <bits/stdc++.h>
#define N 1007
using namespace std;

inline int rd() {
    int x = 0;
    bool f = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) f |= (c == '-');
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    return f ? -x : x;
}

int a[N][N];

int main() {
    int n = rd();
    int r, c;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= n; ++j) {
            a[i][j] = rd();
            if (a[i][j] == -1) {r = i; c = j;}
        }
    int rr = (r < n ? r + 1 : r - 1);
    int cc = (c < n ? c + 1 : c - 1);
    printf("%d\n", a[rr][c] + a[r][cc] - a[rr][cc]);

    return 0;
}

Details

  File "answer.code", line 3
    using namespace std;
          ^^^^^^^^^
SyntaxError: invalid syntax