CSES - COCI 2006/2007 #6 - Results
Submission details
Task:Maraton
Sender:untokarila
Submission time:2019-07-25 17:26:14 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#30.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;

char d[30][30];

bool same(char a, char b, char c){
    return a==b && a==c && b==c;
}

int main(){

    int n;
    cin >> n;

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            cin >> d[i][j];
        }
    }

    if(n>2){
        for(int i=0; i<n-2; i++){
            for(int j=0; j<n-2; j++){
                if(d[i][j] == '.') continue;
                if(same(d[i][j], d[i+1][j], d[i+2][j])){
                    cout << d[i][j];
                    return 0;
                }
                if(same(d[i][j], d[i][j+1], d[i][j+2])){
                    cout << d[i][j];
                    return 0;
                }
                if(same(d[i][j], d[i+1][j+1], d[i+2][j+2])){
                    cout << d[i][j];
                    return 0;
                }
            }
        }
        for(int i=2; i<n; i++){
            for(int j=0; j<n-2; j++){
                if(d[i][j] == '.') continue;
                if(same(d[i][j], d[i-1][j+1], d[i-2][j+2])){
                    cout << d[i][j];
                    return 0;
                }
            }
        }
    }

    cout << "ongoing";
    return 0;
}
/*/

/*/

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:

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

correct output
X

user output
ongoing

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