Task: | Maraton |
Sender: | untokarila |
Submission time: | 2019-07-25 17:30:46 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.01 s | details |
#6 | ACCEPTED | 0.01 s | details |
#7 | ACCEPTED | 0.01 s | details |
#8 | ACCEPTED | 0.01 s | details |
#9 | ACCEPTED | 0.01 s | details |
#10 | ACCEPTED | 0.01 s | details |
Code
#include <bits/stdc++.h> using namespace std; char d[33][33]; 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; i++){ for(int j=0; j<n; j++){ if(d[i][j] == '.') continue; if(i<n-2 && same(d[i][j], d[i+1][j], d[i+2][j])){ cout << d[i][j]; return 0; } if(j<n-2 && same(d[i][j], d[i][j+1], d[i][j+2])){ cout << d[i][j]; return 0; } if(i<n-2 && j<n-2 && same(d[i][j], d[i+1][j+1], d[i+2][j+2])){ cout << d[i][j]; return 0; } if(i>1 && j<n-2 && 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: 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 |