Submission #372687

# Submission time Handle Problem Language Result Execution time Memory
372687 2021-03-01T09:54:52 Z ngpin04 산악 구조대 (JOI13_mountain) C++14
0 / 100
8 ms 492 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int N = 205;
 
int target,r,c;
 
bool ask(int x, int y) {
    if (min(x, y) == 0 || x > r || y > c)
        return false;
    int val = Measure(x, y);
    if (val == target) {
        Pinpoint(x, y);
        exit(0);
    }
    return val > target;
}
 
void Rescue(int n, int m, int rs, int cs, int x) {
    r = n;
    c = m;
    target = x;
    int i,j;
 
    /** right */
    i = rs, j = cs;
    while (ask(i, j + 1))
        j++;
 
    while (true) {
        bool found = false;
        if (ask(i - 1, j)) {
            found = true;
            i--;
        } else if (j - 1 > cs) {
            found = true;
            if (ask(i - 1, j - 1))
                i--;
            j--;
        }
        if (!found)
            break;
    }
 
    /** top */
    i = rs, j = cs;
    while (ask(i - 1, j))
        i--;
 
    while (true) {
        bool found = false;
        if (ask(i, j - 1)) {
            found = true;
            j--;
        } else if (i + 1 < rs) {
            found = true;
            if (ask(i + 1, j - 1))
                i++;
            j--;
        }
        if (!found)
            break;
    }
    /** left */
    i = rs, j = cs;
    while (ask(i, j - 1))
        j--;
 
    while (true) {
        bool found = false;
        if (ask(i + 1, j)) {
            found = true;
            i++;
        } else if (j + 1 < cs) {
            found = true;
            if (ask(i + 1, j + 1))
                i++;
            j++;
        }
        if (!found)
            break;
    }
    /** bot */
    i = rs, j = cs;
    while (ask(i + 1, j))
        i++;
 
    while (true) {
        bool found = false;
        if (ask(i, j + 1)) {
            found = true;
            j++;
        } else if (i - 1 > rs) {
            found = true;
            if (ask(i - 1, j + 1))
                i--;
            j++;
        }
        if (!found)
            break;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 492 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -