QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#328387#7042. So Easy66E61dWA 2ms11600kbC++141.5kb2024-02-15 19:50:492024-02-15 19:50:50

Judging History

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

  • [2024-02-15 19:50:50]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:11600kb
  • [2024-02-15 19:50:49]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pb push_back
#define endl '\n'
#define VI vector<int>
#define pii pair<int, int>
#define rep(i, j, k) for (int i = j; i <= k; ++i)
#define per(i, j, k) for (int i = j; i >= k; --i)
#define print(a) cout << a << endl;

const int inf = 0x3f3f3f3f;
const long long llinf = (long long)0x3f3f3f3f3f3f3f3f;
const long long MOD = (long long)1e9 + 7LL;
const size_t N = (size_t)1e6 + 5;

#define IO                       \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);             \
    std::cout.tie(0)

#define debug(a) std::cerr << "\033[34m" << #a << ':' << a << "\033[0m" << endl

#define debugList(list)                        \
    std::cerr << "\033[34m" << #list << ": ["; \
    for (auto& e : list) {                     \
        std::cerr << e << ", ";                \
    }                                          \
    std::cerr << "\b\b]\033[0m" << endl

#define otto auto

int a[1010][1010];

void solve() {
    int n;
    cin >> n;
    memset(a, inf, sizeof(a));
    int x, y;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cin >> a[i][j];
            if (a[i][j] == -1) {
                x = i;
                y = j;
            }
        }
    }
    cout << min(a[x - 1][y], a[x + 1][y]) + min(a[x][y - 1], a[x][y + 1]);
}   

signed main() {
    IO;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 11524kb

input:

3
1 2 1
0 -1 0
0 1 0

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 11600kb

input:

10
63 66 64 39 41 64 67 46 45 56
67 70 68 43 45 68 71 50 49 60
72 75 73 48 50 73 76 55 54 65
64 67 65 40 42 65 68 47 46 57
81 84 82 57 59 82 85 64 63 74
43 46 44 19 21 44 47 26 25 36
45 48 46 21 23 -1 49 28 27 38
70 73 71 46 48 71 74 53 52 63
57 60 58 33 35 58 61 40 39 50
81 84 82 57 59 82 85 64 63 74

output:

67

result:

wrong answer 1st numbers differ - expected: '46', found: '67'