Submission #372691

# Submission time Handle Problem Language Result Execution time Memory
372691 2021-03-01T09:57:51 Z hoanghq2004 산악 구조대 (JOI13_mountain) C++14
0 / 100
9 ms 2540 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

void Rescue(int n, int m, int RS, int CS, int X) {
    map <int, vector <pair <int, int> > > mp;
    vector <pair <int, int> > block[(n + 10) * (m + 10)];
    vector <vector <int> > height(n + 10, vector <int> (m + 10, -1));
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            mp[abs(i - RS) + abs(j - CS)].push_back({i, j});
        }
    }
    int sz = 0;
    for (auto [id, vcell]: mp) block[sz++] = vcell;
    auto ask = [&](int i, int j) {
        if (height[i][j] != -1) return height[i][j];
        height[i][j] = Measure(i, j);
        if (height[i][j] == X) Pinpoint(i, j);
        return height[i][j];
    };
    int L = 0, R = sz - 1;
    while (R - L > 1) {
        int mid = L + R >> 1;
        if (ask(block[mid].front().first, block[mid].front().second) < X) R = mid;
        else L = mid;
    }
    for (auto [i, j]: block[L]) ask(i, j);
    for (auto [i, j]: block[R]) ask(i, j);
}

Compilation message

mountain.cpp: In function 'void Rescue(int, int, int, int, int)':
mountain.cpp:16:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   16 |     for (auto [id, vcell]: mp) block[sz++] = vcell;
      |               ^
mountain.cpp:25:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   25 |         int mid = L + R >> 1;
      |                   ~~^~~
mountain.cpp:29:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   29 |     for (auto [i, j]: block[L]) ask(i, j);
      |               ^
mountain.cpp:30:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   30 |     for (auto [i, j]: block[R]) ask(i, j);
      |               ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 0 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 0 ms 364 KB Output is correct
22 Correct 0 ms 364 KB Output is correct
23 Correct 0 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 0 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 0 ms 364 KB Output is correct
29 Correct 0 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 0 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 0 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 256 KB Output is correct
39 Correct 0 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 0 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 0 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 1 ms 364 KB Output is correct
47 Correct 1 ms 364 KB Output is correct
48 Correct 0 ms 364 KB Output is correct
49 Correct 1 ms 364 KB Output is correct
50 Correct 1 ms 364 KB Output is correct
51 Correct 1 ms 364 KB Output is correct
52 Correct 1 ms 364 KB Output is correct
53 Correct 0 ms 364 KB Output is correct
54 Correct 1 ms 364 KB Output is correct
55 Correct 1 ms 364 KB Output is correct
56 Incorrect 1 ms 364 KB Wrong Answer [5]
57 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 2540 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -