Task: | Prva |
Sender: | untokarila |
Submission time: | 2019-07-29 16:37:21 +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 |
Code
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main(){ vector<string>ans; int r, c; char d[21][21]; cin >> r >> c; for(int i=0; i<r; i++){ for(int j=0; j<c; j++){ cin >> d[i][j]; } } for(int i=0; i<=r; i++) d[i][c] = '#'; for(int i=0; i<=c; i++) d[r][i] = '#'; string s; for(int i=0; i<=r; i++){ for(int j=0; j<=c; j++){ if(d[i][j] == '#'){ if(s.size() > 1) ans.push_back(s); s.clear(); } else { s.push_back(d[i][j]); } } } for(int j=0; j<=c; j++){ for(int i=0; i<=r; i++){ if(d[i][j] == '#'){ if(s.size() > 1) ans.push_back(s); s.clear(); } else { s.push_back(d[i][j]); } } } sort(ans.begin(), ans.end()); cout << ans[0]; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
4 5
o#dnp zji#f v#d#a e#a## |
correct output |
---|
dida |
user output |
---|
dida |
Test 2
Verdict: ACCEPTED
input |
---|
5 6
#tyt## zaaaaw #l#q#w zephz# ... |
correct output |
---|
tales |
user output |
---|
tales |
Test 3
Verdict: ACCEPTED
input |
---|
7 4
rykj xcm# zz#o #aaa ... |
correct output |
---|
aaa |
user output |
---|
aaa |
Test 4
Verdict: ACCEPTED
input |
---|
8 8
wyhjkeor eo#qyggz cjpuelsd sgqjzwkr ... |
correct output |
---|
cjpuelsd |
user output |
---|
cjpuelsd |
Test 5
Verdict: ACCEPTED
input |
---|
10 15
#zzzzz#adobcxhc p##guvawbwopsic a#xzovd#kiclyht #igrsqowa#bklwg ... |
correct output |
---|
ado |
user output |
---|
ado |
Test 6
Verdict: ACCEPTED
input |
---|
15 15
tkys#tfoatosfdn pcjjhgeoyylnikz anvufh#b#hknkhf cacdlmeypccffje ... |
correct output |
---|
adulqbtwz |
user output |
---|
adulqbtwz |
Test 7
Verdict: ACCEPTED
input |
---|
19 19
##h#cng##x#d###d### ####f###p#####zdp#u niiv#p######vupzp#n p###f#####m#####t## ... |
correct output |
---|
cf |
user output |
---|
cf |
Test 8
Verdict: ACCEPTED
input |
---|
20 20
jd#jlgsr#hwptyhapyaj mh#obte#vaqj#g#gfihp #soucejumbxoqkl#iqmq lw#uprsn#i#dpxtob#gv ... |
correct output |
---|
abfwlrt |
user output |
---|
abfwlrt |