QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#402516 | #8119. Pingvin | lfxxx# | 16 | 18ms | 8272kb | C++17 | 1.4kb | 2024-04-30 19:02:56 | 2024-04-30 19:02:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
bool be;
constexpr int N = 105;
int n, ok[N][N][N];
struct node {
int x, y, z, d;
node(int X, int Y, int Z, int D) {
x = X, y = Y, z = Z, d = D;
}
};
queue<node>q;
bool en;
int main()
{
cerr << (&be - &en) / 1024.0 / 1024 << " MB\n--------------------------------" << endl;
#ifdef IAKIOI
freopen("in.in", "r", stdin);
// freopen("out.out", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, a, b, c, D, e, f;
cin >> n >> a >> b >> c >> D >> e >> f;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
for (int k = 1; k <= n; ++k) {
char c;
cin >> c;
ok[j][k][i] = c == '1';
}
}
}
q.emplace(a, b, c, 0);
while (!q.empty()) {
auto [x, y, z, d] = q.front();
q.pop();
if (x == D && y == e && z == f) {
cout << d << endl;
return 0;
}
auto work = [&](int e, int f, int g) {
if (1 <= e && e <= n && 1 <= f && f <= n && 1 <= g && g <= n && !ok[e][f][g]) {
q.emplace(e, f, g, d + 1);
ok[e][f][g] = 1;
}
};
work(x + 1, y, z);
work(x - 1, y, z);
work(x, y + 1, z);
work(x, y - 1, z);
work(x, y, z + 1);
work(x, y, z - 1);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 7
Accepted
time: 0ms
memory: 3908kb
input:
2 1 2 1 1 2 2 10 10 10 10
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
2 1 2 1 1 1 1 00 10 10 10
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
2 1 2 1 2 1 2 10 00 10 00
output:
3
result:
ok single line: '3'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4040kb
input:
2 1 1 1 2 1 2 00 01 10 00
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 4016kb
input:
2 2 2 1 2 2 1 01 10 11 11
output:
0
result:
ok single line: '0'
Test #6:
score: -7
Wrong Answer
time: 0ms
memory: 3756kb
input:
2 2 1 1 1 1 2 11 01 01 11
output:
result:
wrong answer 1st lines differ - expected: '-1', found: ''
Subtask #2:
score: 16
Accepted
Test #8:
score: 16
Accepted
time: 0ms
memory: 3780kb
input:
5 4 1 1 5 5 4 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000
output:
8
result:
ok single line: '8'
Test #9:
score: 0
Accepted
time: 1ms
memory: 5940kb
input:
10 1 3 1 7 2 2 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000...
output:
8
result:
ok single line: '8'
Test #10:
score: 0
Accepted
time: 1ms
memory: 5936kb
input:
20 3 16 1 15 16 10 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000...
output:
21
result:
ok single line: '21'
Test #11:
score: 0
Accepted
time: 3ms
memory: 6304kb
input:
50 47 4 1 25 32 26 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000...
output:
75
result:
ok single line: '75'
Test #12:
score: 0
Accepted
time: 8ms
memory: 8232kb
input:
100 50 69 1 54 44 33 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
61
result:
ok single line: '61'
Test #13:
score: 0
Accepted
time: 18ms
memory: 8272kb
input:
100 74 34 1 3 27 71 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
148
result:
ok single line: '148'
Test #14:
score: 0
Accepted
time: 15ms
memory: 8264kb
input:
100 73 19 1 29 73 4 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
101
result:
ok single line: '101'
Subtask #3:
score: 0
Wrong Answer
Test #15:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
5 2 4 1 5 1 1 00101 00001 01000 10000 01000 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111 11111
output:
result:
wrong answer 1st lines differ - expected: '-1', found: ''
Subtask #4:
score: 0
Wrong Answer
Test #24:
score: 25
Accepted
time: 1ms
memory: 5928kb
input:
5 2 3 1 4 2 5 00001 10011 10111 00000 00100 11010 11010 00110 11101 00100 01101 01001 11001 00111 00110 01111 11100 00000 10101 11100 01011 10001 01100 00100 10101
output:
7
result:
ok single line: '7'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
10 6 1 1 8 3 10 0001110110 1001010001 1010001011 1011101001 1101110011 0011000110 1000110101 0000011001 1010011011 0010101000 1010000101 0001011000 1010100011 0001100000 0111000010 0100011111 0000100000 1010001111 0110010000 1110000010 0001010011 0101101001 0111111001 1100110011 1010000110 111110111...
output:
23
result:
ok single line: '23'
Test #26:
score: 0
Accepted
time: 1ms
memory: 6156kb
input:
20 4 18 1 5 8 14 01100101110111111000 00000010011001101100 10010000110101111100 11000100000011101000 01100001001100100100 01010100011111100101 11110010001100111001 10101100111010010101 00011010001110000110 01001111110101101111 11101101100001110011 00010111010111001000 01001111010111111101 0011011110...
output:
30
result:
ok single line: '30'
Test #27:
score: 0
Accepted
time: 4ms
memory: 6512kb
input:
50 3 42 1 36 19 48 11000010101010011100010011100001111100000010111110 00011000010010011011111111111111110010000010011001 10110111000011011000011001010101011100110001101000 10000111011110000110100010010110111101110110100101 00111110100110011001101001001011001110110110111011 11101101010010000010101001...
output:
103
result:
ok single line: '103'
Test #28:
score: 0
Accepted
time: 10ms
memory: 8140kb
input:
100 31 67 1 37 59 23 1011101001001010010000001101110111001000010000010010100010101111101011111010000111101101010101101100 0111100100011010111011000010100101000010000110101110100110100001110101101111110100000100011101001011 00111100010011011100010111001010111101111011001100010010001011010110001001101...
output:
42
result:
ok single line: '42'
Test #29:
score: 0
Accepted
time: 7ms
memory: 8240kb
input:
100 37 5 1 69 20 14 0000100100100000010110110010001110101011010111100000110100111011101010001111111111101010011110000011 1101011100011110010001000010010010001000111111110000110010011101110110011110110101011011110110101100 011001101010111011101001110010000100010111101111011100101000110010010001111001...
output:
64
result:
ok single line: '64'
Test #30:
score: 0
Accepted
time: 14ms
memory: 8188kb
input:
100 95 69 1 11 72 6 1110010001100010100001100111001111010010011011101000110000100100111000000000100101100101111100000010 1101100100000100110110011000010110000101010000101111100011000011110110111100101011011000011001100110 001000111111001111000101101101100111011100000000011110000001100001011101001111...
output:
124
result:
ok single line: '124'
Test #31:
score: -25
Wrong Answer
time: 6ms
memory: 8184kb
input:
100 28 20 1 85 37 33 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
result:
wrong answer 1st lines differ - expected: '-1', found: ''