CSES - COCI 2006/2007 #6 - Results
Submission details
Task:Maraton
Sender:henrikaalto
Submission time:2019-07-25 16:28:10 +0300
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails
#6ACCEPTED0.01 sdetails
#7ACCEPTED0.01 sdetails
#8ACCEPTED0.01 sdetails
#9ACCEPTED0.01 sdetails
#10ACCEPTED0.01 sdetails

Code

#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define F first
#define S second
using pi=pair<int,int>;
using ii=long long;
int main()
{
    int n;
    cin >> n;
    vector<string>v(n);
    for (int i = 0; i < n; ++i) {
        cin>>v[i];
    }
    char lol = '.';
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j< n; ++j) {
            if (i + 2 < n) {
                if (v[i][j] == v[i + 1][j] && v[i][j] == v[i + 2][j]) {
                    if (v[i][j] != '.')lol = v[i][j];
                }
            }
            if (j + 2 < n) {
                if (v[i][j] == v[i][j + 1] && v[i][j] == v[i][j+2]) {
                    if (v[i][j] != '.')lol = v[i][j];
                }
            }
            if (j + 2 < n && i + 2 < n) {
                if (v[i][j] == v[i + 1][j + 1] && v[i][j] == v[i + 2][j + 2]) {
                    if (v[i][j] != '.')lol = v[i][j];
                }
            }
            if (j - 2 >= 0 && i + 2 < n) {
                if (v[i][j] == v[i + 1][j - 1] && v[i][j] == v[i + 2][j - 2]) {
                    if (v[i][j] != '.') lol = v[i][j];
                }
            }
        }
    }
    if (lol=='.') cout << "ongoing\n";
    else cout << lol << "\n";
}

Test details

Test 1

Verdict: ACCEPTED

input
5
LUKA.
LOVRO
LUKA.
VR...
...

correct output
L

user output
L

Test 2

Verdict: ACCEPTED

input
10
K.Z.....X.
F....ZJ.T.
...XIK..J.
TZQ.I.T.QK
...

correct output
ongoing

user output
ongoing

Test 3

Verdict: ACCEPTED

input
10
RGZRJJ.XPI
.RPZPZPGG.
XIPT.JIPZZ
ZT.G.JX..P
...

correct output
X

user output
X

Test 4

Verdict: ACCEPTED

input
5
..YYA
HDHAD
DAHAY
YYHD.
...

correct output
H

user output
H

Test 5

Verdict: ACCEPTED

input
15
MG.YGVUGU.F.F.G
MQYWAEB.EB.U..O
M.PW.FCBLADGWTH
NHDEY..YKDFRF.A
...

correct output
M

user output
M

Test 6

Verdict: ACCEPTED

input
19
JRHCV..QNN.NQVE...O
OE..R.VDT..DPNJK.M.
.MQ.BYVHVJDE....J.I
YBTMLJYKEO..OM.BHCR
...

correct output
Y

user output
Y

Test 7

Verdict: ACCEPTED

input
19
.X.........X..W....
W...........X..XXW.
...........XX......
.....W.....XX......
...

correct output
X

user output
X

Test 8

Verdict: ACCEPTED

input
19
...G..X.V.J.....P..
....FT..Y.Y.G......
..J.O..YQ..H.......
......UDF....H.P...
...

correct output
D

user output
D

Test 9

Verdict: ACCEPTED

input
19
V.................V
...................
..V.............V..
...................
...

correct output
V

user output
V

Test 10

Verdict: ACCEPTED

input
18
D...Y...S.OSOY....
..YR...Z..I......R
.....M.MDK..A.....
Z.LO..L..KX...Z...
...

correct output
M

user output
M