QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#457082 | #8118. Pahuljice | fryan# | 50 ✓ | 0ms | 3744kb | C++20 | 2.3kb | 2024-06-29 01:28:26 | 2024-06-29 01:28:26 |
Judging History
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
const int mxn = 50;
int n, m, g[mxn+2][mxn+2];
vector<array<int,2>> src;
signed main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
char c; cin >> c;
if (c == '+') {
src.push_back({i,j});
}
if (c == '\\') {
g[i][j] = 1;
}
if (c == '/') {
g[i][j] = 2;
}
if (c == '|') {
g[i][j] = 3;
}
if (c == '-') {
g[i][j] = 4;
}
// cout << g[i][j] << " ";
}
// cout << "\n";
}
int mx = 0;
for (array<int,2> p : src) {
int cx = p[0], cy = p[1];
int x1, y1;
//up
int un = 0;
x1 = cx, y1 = cy;
while (g[x1-1][y1] == 3) {
un++; x1--;
}
//down
int dn = 0;
x1 = cx, y1 = cy;
while (g[x1+1][y1] == 3) {
dn++; x1++;
}
//left
int ln = 0;
x1 = cx, y1 = cy;
while (g[x1][y1-1] == 4) {
ln++; y1--;
}
//rght
int rn = 0;
x1 = cx, y1 = cy;
while (g[x1][y1+1] == 4) {
rn++; y1++;
}
//northeast
int nen = 0;
x1 = cx, y1 = cy;
while (g[x1-1][y1+1] == 2) {
nen++; x1--; y1++;
}
//southeast
int sen = 0;
x1 = cx, y1 = cy;
while (g[x1+1][y1+1] == 1) {
sen++; x1++; y1++;
}
//southwest
int swn = 0;
x1 = cx, y1 = cy;
while (g[x1+1][y1-1] == 2) {
swn++; x1++; y1--;
}
//notrthweset
int nwn = 0;
x1 = cx, y1 = cy;
while (g[x1-1][y1-1] == 1) {
nwn++; x1--; y1--;
}
// cout << cx << " " << cy << ":\n" << un << " " << dn << " " << ln << " " << rn << "\n";
// cout << nen << " " << sen << " " << swn << " " << nwn << "\n\n";
vector<int> val = {un,dn,ln,rn,nen,sen,swn,nwn};
int mnv = 1e18;
for (auto i : val) {
mnv = min(mnv, i);
}
mx = max(mx, mnv);
}
cout << mx;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 11
Accepted
Test #1:
score: 11
Accepted
time: 0ms
memory: 3588kb
input:
10 10 .\|/...... .-+-\|/... ./|\-+-... ..\|/|\... ..-+-..... ../|\\|/.. .....-+-.. ...../|\.. .......... ..........
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
20 20 ......\|/........... ......-+-........... ....../|\.......\|/. ........\|/.\|/.-+-. ........-+-.-+-./|\. \|/...../|\./|\.\|/. -+-...\|/.\|/...-+-. /|\...-+-.-+-.../|\. ...\|//|\./|\....... ...-+-.............. .../|\.............. ..........\|/....... .......\|/-+-....... .......-+-/|\..\|/.. ...
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
50 50 ......\|/.....................................\|/. ......-+-.\|/.................................-+-. ....../|\.-+-.........\|/.\|/.\|/..........\|//|\. ........../|\|/.......-+-.-+-.-+-..\|/.....-+-\|/. ............-+-\|/..\|/|\./|\./|\|/-+-\|/../|\-+-. ........\|/./|\-+-..-+-...\|/...-+-/|\-...
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
50 50 ...................\|/............................ ...................-+-.........\|/................ .......\|/........./|\.........-+-...........\|/.. .......-+-...................../|\...........-+-.. .\|/.../|\....\|/............\|/..\|/......../|\.. .-+-..........-+-\|/.........-+-..-+-.\...
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
10 10 ..+..\/..- /.--|\+..+ /..--++.|. |.-+.-.... ...+....+. .\.\/..+|- +.|\|..++. ..\\|\\|.. .-.-\|-/.. +\//.+--.\
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
20 20 ../.||..+.\|+/..\\\\ |++.+./....\\/..++.. ..+/...+|//+.|/.\|.\ \|..|..\.\+\..|-.\.- |\.+-\.....-..|..+.| .\-+...+///+.|.....+ \-/\...-..../.|/+.+. -.....++|/+..-...\-\ -+..+...\-..++.+-../ //+.+.++.-|//../+.\| .|...\..../../+.|+-. \/---\..-|/\/......\ |||./+-./.|.\\|./|-- ./|.\....\+...\/..+| ...
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
50 50 |\/.+/.+../....-+\..../+/../-/.|-./...\..+-\+.|.|+ \.-.-..../..|-......|-\..+.\..|.\...-/..-..\-|.|/- ./\..+/.-++/\-+./\+.\.-|+.....++.|-....\./|..-\--. .\./.|.../../..|./.../\.+..+\.../......-|-.//...|+ \../.+-../.../.|..|../+......//./.-+\+.\/-|\++/+.. ../.\...\\..|..\.-/.-|\.+||.|../\\\..+....
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
50 50 .....\.++...+.....+./.-..-....|..\--....+.+..\.../ |+.+-.|..++|...+|.++.|.../..+.|.+...\\.-+..+./\-/- .....\-.\/-\/\-/.-/...\++...+\|\.\...//.-|\....\\/ ...-.../+/.|\\.\+..-//../..|--..\+.++\.+|..|+|\../ ./+.-\-+..||\..|-/....-.|\/-./\\-+.|..|/\-../...-+ --|.|-||\-.....\..-|-../\...+-|.\-+\..\...
output:
0
result:
ok single line: '0'
Subtask #2:
score: 11
Accepted
Test #9:
score: 11
Accepted
time: 0ms
memory: 3664kb
input:
5 5 .|../ .|./. \|/.. -+--- /|\..
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
10 10 .\/|.//... ./-|..../. ---+------ .\/|\..... ././.\..\. /..|..\... ...|...\\. ...|....\. ...|.--\/\ ...|..\...
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
20 20 /.......././.\....|. ......../.....\...|. ...............\..|. ................\.|. ../..............\|/ \-----------------+- ......./.\......./|\ ..................|. .............../..|. ............./....|. ............./....|. ............/...../. .........../......|. .......././.......|. ...
output:
1
result:
ok single line: '1'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
20 20 ...............|.... \..............|.... .\.............|.... |.\............|.... .-.\..\........|.... ....\..........|.... .....\.........|.... ......\...|....|.-.. .......\.......|.|.. ....-...\......|.... .....-...\.....|.... ..........\....|.... |..........\...|.../ ............\..|../. ...
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
50 50 .....-\............/....|...........\......|...... /........./...-.|\..\..-.............\.../.|...../ .../...-\.....-/..-........../|......./....|..../. .....\...|......./................/....\...|..//.\ .................|.........././...|.....\/.|../... .......\.........\.../........\....\./\...
output:
2
result:
ok single line: '2'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
50 50 -........./....../......||........../............. ../\....//.-.......|.....|........................ ..-..../.................|..........-.........-... .................../.\...|...../............/....- ..|.|....\-..../...|....-||.......-...-......\./.. ...-././.....-....\..-...|./..............
output:
3
result:
ok single line: '3'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
50 50 ..............\.\.......\.\........./....|........ .........................\...............|........ ...............\..........\..............|../..... .............\.............\..........\../........ ..\.........................\\...........|........ ...........\...\.............\.....\......
output:
7
result:
ok single line: '7'
Subtask #3:
score: 28
Accepted
Test #16:
score: 28
Accepted
time: 0ms
memory: 3620kb
input:
5 5 .|./\ \|/.. -+--- /|\.. .|.\/
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
10 10 ......\|/. .\.|./-+-. ..\|/./|\. .--+--.... .\/|\/.... ./\|/\.... .--+--.... ../|\.\|/. ./.|.\-+-. ....../|\.
output:
2
result:
ok single line: '2'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
20 20 .\|/\|/\|/..\.|./... .-+--+--+--..\|/.... ./|\/|\/|\.---+---.. \.|././\|/\../|\.... .\|/...-+-../.|.\... --+--../|\|/..|..\.. ./|\.....-+-........ /.|.\..../|\.\..|../ ....\..|../...\.|./. .....\.|./.....\|/.. \|/...\|/.\|/---+--- -+-.---+---+-../|\.. /|\/../|\./|\./.|.\\ \|/../.|.\.../..|..\ ...
output:
3
result:
ok single line: '3'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
30 30 .\.|./....\|/.\|/\|/\|/....... ..\|/.....-+-.-+--+--+-.\|/... ---+------/|\\/|\/|\/|\.-+---- ../|\..\|/....\|/...\.|./|\... ./.|.\.-+-\|/--+--...\|/...... /..|..\/|\-+-./|\...--+--..... ...|...\\./|\/.||\|/./|\/..../ .|.|.../\\......|-+-/.|/\\../. .|.|../..\\.....|/|\../...\/.. .|.../..\.|\/.....
output:
8
result:
ok single line: '8'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
40 40 ...\..|../..\|/...\|/...\|/............. ....\.|./...-+-..--+--.--+--....\|/..\|/ .....\|/..../|\..\/|\/../|\.....-+-..-+- ...---+---....\|//\|/\./.|\\.|../|\../|\ ..|../|\..|...-+---+--..../\.|./..\....\ \.|./.|.\.|.../|\./|\..../..\|/....\.... .\|/..|..\|\|/.../\|/\../.---+---\|/\... --+---....
output:
10
result:
ok single line: '10'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
50 50 \|/..\|/...\|/......\.......|\.|./.\/.|../.....\|/ -+----+---.-+-\.|./..\...\|/|.\|/../\.|./\.|./.-+- /|\../|\.../|\.\|/....\..-+-|--+--/..\|/..\|/../|\ ..../.|.\.|./.--+--.\.|\//|\|./|\/----+----+--.... .../.\|/.\|/.../|\...\|/\...|/.|/\.../|\../|\..... .|./.-+---+--./\|/\.--+--\..|../..../.|...
output:
8
result:
ok single line: '8'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
50 50 .\.|./...\.|./..\...\|/|....../........\.|./...... ..\|/\.|./\|/....\..-+-|\|/../...\.|./..\|/....... .--+--\|/--+--.\|/\./|\|-+-./.....\|/----+----\|/. ../|\--+--/|\..-+-.\...|/|\/.\|/.--+--../|\...-+-. ./\|/\/|\/\|/\./|\|/\..|../..-+-../|\../.|.\../|\. ..-+-/.|.\-+-....-+-.\.|./.../|\./.|.\/...
output:
7
result:
ok single line: '7'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
50 50 ...\|/......\|/..\....|..../...\|/...\|/..\|/\|/.. ...-+-\|/.---+---.\...|.../.\|/-+-...-+-.--+--+--. .\|/|\-+-.../|\....\..|../..-+-/|\|/./|\../|\/|\.. .-+-../|\../.|.\....\.|./.../|\..-+-...../.|/\|.\. ./|\....../..|..\....\|/........./|\........\|/... ..--------------------+----------------...
output:
8
result:
ok single line: '8'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
50 50 ........\|/\|/.\|/.\|/|.\|/....\.|./....\|/../...\ \...\|/--+--+---+-.-+-|.-+-.....\|/\|/.--+--/..\|/ .\..-+-./|\/|\./|\./|\|./|\....--+--+-../|\/...-+- .|\./|\/.|/\||\/......|\...|...//|\/|\|/.|/\.\./|\ .|.\../.....\|/.\|/\|/|.\..|..//.|.\.-+-./....\... .|..\/.\|/.--+---+--+-|..\.|./\.|./../|...
output:
22
result:
ok single line: '22'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
50 50 .|-./..|++/+|./-./\\\+.-..\-..|\/..//|/-..../.-.\+ /++....+-+...-|\-.-|+..\+...\\.../\../\-|.\-.+.... -.|.--|../--|.....--|.../\/.|-/-/./.-/+|./..-.+..\ |+.\../-|.--/+|..-/.|..-/+-\.-\.../\.\+.\../+-...- |+.+...|+....\++..+/...+|...||+..\.|..\|../.\\--.. ./.\.-\.-\+/-.|.++..-.\/-+|.|.-++..////...
output:
0
result:
ok single line: '0'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
50 50 +/+|.-/||.+|+-/+./../|.-/\|.+\\...+\\/.++//.-.\+|/ |....../...+/..|./-/-\||++-.\+.-|.\+|/-+\.\.-//\+\ \|..//|//.|.-..|\/.\..\||/\.\|+/-+-....+..|....\.- ++.\.|.+.\/.\+||/...\+./\..\.||.|.|..|||+\.-\|++.. +\..|.-....-/..-\++.-..|\|./.-\.+.-.|..+.--..\|\.\ ./..../|..|-|+.|+|.++|...+||/|\/|.-..+....
output:
0
result:
ok single line: '0'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
50 50 ||.+|+-..\+.\|\/-|....-|//+/|///\\\\|.-.-../.+\--. +/+./||+-\....\.\|.-.||-../...\..././\/.+-+..//.|\ .\.\+-+--\...\.//.|//.\+.-//.+/+./-/.+|./.-...../- |+\|.....+-.-....+-..\..-../\..|\--.\++....-/./+\/ ./|\/-....|/\+-|\-.|--./+/|+-.-.+.+-..+\|..-..++|. .+-..|..+.|+\..\|/-|-+/.+..|-/.|+\|+\/\...
output:
0
result:
ok single line: '0'
Extra Test:
score: 0
Extra Test Passed