QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#184587 | #4297. Prank at IKEA | SorahISA | AC ✓ | 101ms | 90820kb | C++20 | 6.2kb | 2023-09-20 21:39:05 | 2023-09-20 21:39:06 |
Judging History
answer
#ifndef Yamada
#define Yamada
#include Yamada __FILE__ Yamada
void solve() {
int N, M; cin >> N >> M;
vector<string> grid(N);
for (string &str : grid) cin >> str;
vector indices(N, vector(M, vector<int>()));
vector<pii> index_mapping;
int index_tok = 0;
for (int i = 0; i < N-1; ++i) {
for (int j = 0; j < M; ++j) {
if (grid[i][j] == '.' or grid[i][j] != grid[i+1][j]) continue;
if (isupper(grid[i][j])) {
if (j+1 < M and grid[i][j+1] == '.' and grid[i+1][j+1] == '.') {
index_mapping.eb(i, j);
indices[i ][j ].eb(index_tok);
indices[i+1][j ].eb(index_tok);
indices[i ][j+1].eb(index_tok);
indices[i+1][j+1].eb(index_tok);
++index_tok;
}
}
else {
if (j-1 >= 0 and grid[i][j-1] == '.' and grid[i+1][j-1] == '.') {
index_mapping.eb(i, j-1);
indices[i ][j ].eb(index_tok);
indices[i+1][j ].eb(index_tok);
indices[i ][j-1].eb(index_tok);
indices[i+1][j-1].eb(index_tok);
++index_tok;
}
}
}
}
for (int i = 0; i < N; ++i) {
for (int j = 0; j < M-1; ++j) {
if (grid[i][j] == '.' or grid[i][j] != grid[i][j+1]) continue;
if (isupper(grid[i][j])) {
if (i+1 < N and grid[i+1][j] == '.' and grid[i+1][j+1] == '.') {
index_mapping.eb(i, j);
indices[i ][j ].eb(index_tok);
indices[i ][j+1].eb(index_tok);
indices[i+1][j ].eb(index_tok);
indices[i+1][j+1].eb(index_tok);
++index_tok;
}
}
else {
if (i-1 >= 0 and grid[i-1][j] == '.' and grid[i-1][j+1] == '.') {
index_mapping.eb(i-1, j);
indices[i ][j ].eb(index_tok);
indices[i ][j+1].eb(index_tok);
indices[i-1][j ].eb(index_tok);
indices[i-1][j+1].eb(index_tok);
++index_tok;
}
}
}
}
// debug("ALIVE");
vector<vector<int>> adj(index_tok);
for (int i = 0; i < N; ++i) {
for (int j = 0; j < M; ++j) {
assert(SZ(indices[i][j]) <= 2);
if (SZ(indices[i][j]) == 2) {
adj[indices[i][j][0]].eb(indices[i][j][1]);
adj[indices[i][j][1]].eb(indices[i][j][0]);
}
}
}
// debug("ALIVE");
vector<int> vis(index_tok, 0);
auto dfs = [&](int st) -> vector<int> {
vector<int> path;
deque<int> deq{st};
while (SZ(deq)) {
int now = deq[0]; deq.pf();
if (vis[now]) continue;
vis[now] = 1, path.eb(now);
for (int x : adj[now]) {if (!vis[x]) deq.ef(x);}
}
return path;
};
vector<int> unroll;
for (int i = 0; i < index_tok; ++i) {
if (vis[i] or SZ(adj[i]) > 1) continue;
auto path = dfs(i);
for (int j = 0; j < SZ(path); j += 2) unroll.eb(path[j]);
// debug(i, path);
}
for (int i = 0; i < index_tok; ++i) {
if (vis[i]) continue;
auto path = dfs(i);
for (int j = 1; j < SZ(path); j += 2) unroll.eb(path[j]);
// debug(i, path);
}
// debug("ALIVE");
for (int i : unroll) {
auto [x, y] = index_mapping[i];
char num = '1' + (3*(x%3) + (y%3));
grid[x][y] = grid[x][y+1] = grid[x+1][y] = grid[x+1][y+1] = num;
}
for (int i = 0; i < N-1; ++i) {
for (int j = 0; j < M; ++j) {
if (!isalpha(grid[i][j]) or grid[i][j] != grid[i+1][j]) continue;
char num = '1' + (3*(i%3) + (j%3));
grid[i][j] = grid[i+1][j] = num;
}
}
for (int i = 0; i < N; ++i) {
for (int j = 0; j < M-1; ++j) {
if (!isalpha(grid[i][j]) or grid[i][j] != grid[i][j+1]) continue;
char num = '1' + (3*(i%3) + (j%3));
grid[i][j] = grid[i][j+1] = num;
}
}
cout << SZ(unroll) << "\n";
for (int i = 0; i < N; ++i) cout << grid[i] << "\n";
}
signed main() {
IOS();
int t = 1; // cin >> t;
for (int i = 1; i <= t; ++i) solve();
return 0;
}
#else
#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
// #define double __float80
using pii = pair<int, int>;
template <typename T> using MaxHeap = std::priority_queue<T>;
template <typename T> using MinHeap = std::priority_queue<T, vector<T>, greater<T>>;
// #define X first
// #define Y second
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define SZ(a) (int)((a).size())
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
template <typename T>
ostream & operator << (ostream &os, const vector<T> &vec) {
os << "[";
for (int i = 0; i < SZ(vec); ++i) {
if (i) os << ", ";
os << vec[i];
}
os << "]";
return os;
}
#ifdef local
#define IOS() void()
#define debug(...) \
fprintf(stderr, "%sAt [%s], line %d: (%s) = ", "\u001b[33m", __FUNCTION__, __LINE__, #__VA_ARGS__), \
_do(__VA_ARGS__), fprintf(stderr, "%s", "\u001b[0m")
template <typename T> void _do(T &&_t) {cerr << _t << "\n";}
template <typename T, typename ...U> void _do(T &&_t, U &&..._u) {cerr << _t << ", ", _do(_u...);}
#else
#define IOS() ios_base::sync_with_stdio(0); cin.tie(0)
#define debug(...) void()
#define endl '\n'
#endif
// mt19937_64 rng(steady::chrono_clock::now().time_since_epoch().count());
template <typename T, typename U> bool chmin(T &lhs, U rhs) {return lhs > rhs ? lhs = rhs, 1 : 0;}
template <typename T, typename U> bool chmax(T &lhs, U rhs) {return lhs < rhs ? lhs = rhs, 1 : 0;}
#endif
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
input:
4 4 .AA. A..a A..a .aa.
output:
2 .22. 4224 4884 .88.
result:
ok 2 unfolded couches
Test #2:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
3 4 .XX. .... YYZZ
output:
1 .22. .22. 7799
result:
ok 1 unfolded couches
Test #3:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
3 4 .XX. .... yyzz
output:
2 .22. 4466 4466
result:
ok 2 unfolded couches
Test #4:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
5 5 .Q... FQ... F.Q.. o.Q.k o...k
output:
2 .22.. 422.. 4.99. 1.992 1...2
result:
ok 2 unfolded couches
Test #5:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
10 10 .......... .......F.. .......F.. .......... ........LS q.d.....LS q.d....... ....wD.... .g..wDU.l. .g....U.l.
output:
5 .......... .......55. .......55. .......... ........64 788.....64 788....... ...446.... 77.446788. 77....788.
result:
ok 5 unfolded couches
Test #6:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
10 10 UYN..qdM.. UYNKeqdMXQ AxUKeGaPXQ AxU.fGaP.. hdWRfQgsbG hdWR.QgsbG ZyTKg..v.n ZyTKgaJvKn eUAwiaJXKV eUAwi..X.V
output:
0 123..312.. 1234531264 7894597864 789.2978.. 4564264564 4564.64564 12312..2.1 1231264261 7897864867 78978..8.7
result:
ok 0 unfolded couches
Test #7:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
100 100 .................................................................................................... .......T............................s............................................................... .......TV...........................s................................X.............u.........
output:
96 .................................................................................................... .......5...........................66............................................................... .......599.........................66................................77...........88..............
result:
ok 96 unfolded couches
Test #8:
score: 0
Accepted
time: 1ms
memory: 4004kb
input:
100 100 .t................u..Sc.............K.....................F........n..........g.......n............E .t....j...........u..Sc.......B...w.K...................csF......T.n..........g.......n........g.X.E f..n..j.............f....l....B.H.wsh.q.................cs.......T.NY..............D..k......
output:
664 11...............33..12.............11....................22......11.........33......22............1 11...66..........33..12.......44.44.11.................55422.....611.........33......22.......55.551 7.99.66............88...77....449449788................554.......6.899.............9988..........
result:
ok 664 unfolded couches
Test #9:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
100 100 ...Z..G.em....S...g.......h.....scG.K..t.g...IJ..zLFw.k.pI..t.....z....hnrJs...E.L....qpg..xBt.t.ldo ..UZo.G.em.nPzSKIqglw..H.Hh.j.ZOscG.KH.t.gG..IJw.zLFwQkspI..t..k..zX.b.hnrJs.s.E.L.u..qpg..xBt.tPldo s.Uaok....wnPzZKIq.lw..H.H.TjFZO.OqYpHKLx.GXi.Sws.oI.Q.s....eKBk...X.btB.A.A.s.vF.luE..J.x...
output:
554 ...1..1221....3...1.......3.....31221.3322...12.11312.1.31133....33...221231...2211..2212.113122.231 ..615.1221.6453456156..6653.5.4531221533224..1261131261531133..4.3356622123155.22116.2212.1131224231 7.6759....86459456.56..665.75945.78975978.489.867.97.6.5...99894...56689.8.75577977677.788.8.7...
result:
ok 554 unfolded couches
Test #10:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
100 100 T..WXDqAi.IjFy..E.hANJHDO.fATC..LD.BM.Z.t..fzCHpFH.dSN..f.A..v.UkaJXi..J.UAG.jJy.FB..Nk.cG.x.z.F.gB. TvbWXDqAicIjFyCeEMhANJHDOYfATCAtLDYBMAZJtbIfzCHpFHMdSNaDfJAIzvAUkaJXiAfJmUAGMjJyGFBikNkNcGqxrzrFWgBt uvbifL.E.cYyYZCe.M...MTk.Y...LAt.TYQ.AtJxbIsMVbSY.MTBgaDhJ.IzQAl.XhlgAfImVvVMUF.GWYik.XNHz...
output:
0 1..123123.2312..2.1231231.3123..31.31.3.2..2312312.123..3.2..2.123123..3.231.312.12..23.23.2.1.3.23. 1561231234231264261231231531234531531534264231231261234534264261231234534231531261264234234261534234 756789.8.4897864.6...789.5...945.759.594864897897.67894594.64867.97894594897597.67864.94894.6.59...
result:
ok 0 unfolded couches
Test #11:
score: 0
Accepted
time: 16ms
memory: 29736kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
9635 ..........................................................................................................................................................................................................................................................................................................
result:
ok 9635 unfolded couches
Test #12:
score: 0
Accepted
time: 37ms
memory: 41624kb
input:
1000 1000 ..........................................V...zB..................................V.........................................................l.h..................P...........X.........Y......u.....d..nU..............Y.......e......A..v..........P...........p.........v.W......n.L...............
output:
66359 ..........................................1..1133.................................22.......................................................22.2..................33..........33........1.....11....11.1133.............33.....11......33.3..........22.........11.........3.22....22.22..................
result:
ok 66359 unfolded couches
Test #13:
score: 0
Accepted
time: 48ms
memory: 39788kb
input:
1000 1000 ..E...FM.YW.Ayk.ebc...b..mx..W.Z.D...Gg.bj...Y.i....y.GKa.GM...C..N...O.....Q..Q...X.Q..k..JzA....qF.i.KFW..w.....U...X.M..y.ns..x..N.M....h.E.n...g....zZ.s..g...y..F..V...Qt.d..J.G...UxRf.RAQx.A.q.PM.rp..sW.uoYt.r.r.f.......H....bC..e.......n...w..ka...sj..fL.g....t...T......z.COH..T.b......
output:
55192 ..33..12.12.123.231...2.113..332.1...23.23...122...11.123.233..11.11..22....2..22..332..2..231...221.3.231133.....11..2.1..1.31..1..1133..11.1.3...1...221.3.22...1..1..1...23.2..2.11..2312.1231.311.12.12.113.2312.1.3.2.......1...221133......22..33..12...31..1233...22...1.....11.1233.311....1.....
result:
ok 55192 unfolded couches
Test #14:
score: 0
Accepted
time: 43ms
memory: 34604kb
input:
1000 1000 Wn.Rf.X.K..J..v.J.W.h..ru..FwhO.ZzQfFx..b.A..g..ItV....a....SQZ.........oY.Z...w...y.kiC..eM.mK.HL.MpC..p.N....BurT..D.Y.ND.e...UIsLQ...AyD.svyIlD..E.xq.Gj.ZakC.....o.ouFv.T...DK.B.vF......H...I...M.....S.rH..u.we.OrI.N.qr..e..d..........OC.Y...A.oZ.J.AE...I.......w..Ni....u...d.SK.By..b.....
output:
31459 12.12.1.3..3.22.22122..31..12311312312.11.1..1..1233...2....123........33221...2...31131.332332.122123.22.22...1231..1.3323.2...31231...231.312312..2.12.12.1231.....122123.22..31.3.23......1...2...3.....3.233.3.23.23113113..3..3..........23322..3.23.2.12...33.....11..23...11..22.23323.22.22..3...
result:
ok 31459 unfolded couches
Test #15:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
1 1000 ........................................................................................................................................................................................................................................................................................................
output:
0 .............................................................................................................................................................................................................................................................................................................
result:
ok 0 unfolded couches
Test #16:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
1000 1 . U U . . . . . . G G t t . . . . G G . . . . . . . . . . . . . I I K K . . Z Z Q Q . . . e e . . . . . . i i . . . . . . x x . h h . . Y Y . . . . . . a a . . . . . n n . . . b b . . n n . . H H . . . . . . . C C . . . . J J . M M . . D D . . . X X . . T T . . . . . . a a . . . . . S S . a a...
output:
0 . 4 4 . . . . . . 1 1 7 7 . . . . 7 7 . . . . . . . . . . . . . 7 7 4 4 . . 7 7 4 4 . . . 1 1 . . . . . . 7 7 . . . . . . 4 4 . 4 4 . . 7 7 . . . . . . 4 4 . . . . . 7 7 . . . 4 4 . . 7 7 . . 1 1 . . . . . . . 1 1 . . . . 1 1 . 1 1 . . 4 4 . . . 1 1 . . 4 4 . . . . . . 1 1 . . . . . 4 4 . 4 4 . . ...
result:
ok 0 unfolded couches
Test #17:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
2 999 ...g.fX..Dj.N.tz.....Wr.nAs...Qp.J.jdGb...z....g....p.g.t...l.Jrnjl....A.ph....k.z.......IZGId..y..h....y..NW.X....v.O.k...px..b....I.o......dg.kpXgw..Y.s..t......k..E..VKz...wd..............Fg..d.o..S..f.JmP..x...J........hC.J........q...UYT...m.......Uf.......Lm......J.........H.....D.V.f.vA...
output:
183 ..332211.12.1221.....123323...12.122123..33...22...113322..33.31231....3113...1133.......31231.33.33...22..31133..11.122..332.11....122.....332332312..233.33.....11..22.231..113..............31.3322..3322.231133...22......113322......11...3122.22.......23.......23......11........22....2212211332...
result:
ok 183 unfolded couches
Test #18:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
999 2 .n .n .. .. a. a. .. .. .. .. .. .. .. .. w. w. .. .. h. h. r. r. .A .A .. t. t. .. .. .M .M .. .. s. s. y. y. f. f. .. .. .. .. .. .D .D .. A. A. .. .. .. .. .. .. .. Q. Q. .. GL GL .. .. .. .. .. .. r. r. G. G. .. .. .. .U .U F. F. .. .. .. .. .. .. .. .. .. .. b. b. .. .. i. i. .. .. .S .S ...
output:
79 11 11 .. .. 4. 4. .. .. .. .. .. .. .. .. 7. 7. .. .. 1. 1. 7. 7. .5 .5 .. 4. 4. .. .. .8 .8 .. .. 1. 1. 7. 7. 4. 4. .. .. .. .. .. .8 .8 .. 77 77 .. .. .. .. .. .. .. 77 77 .. 78 78 .. .. .. .. .. .. 4. 4. 11 11 .. .. .. .8 .8 44 44 .. .. .. .. .. .. .. .. .. .. 4. 4. .. .. 7. 7. .. .. .2 .2 77 ...
result:
ok 79 unfolded couches
Test #19:
score: 0
Accepted
time: 73ms
memory: 74652kb
input:
1000 1000 WW..PP..YYRRD.X.RR.z.k...mN...JJCC..QQ.p....E.L.G.H..w....M....gW.QQIIV.C.WWU..s..P.QQ..L....n.g..C.R.MMZ..w..P..rM.O.CCZ..zBBNNE.NN.jZZN..aIIRR.....j....R..cU.XX.s..DD...s.e.iH.JJ..QQ.jRR...j.jAAM...TTP..pSSV.....JJ..RR....MMVVC.KK.g.u.wU.......OON.SS..K.D.........I.FF.vXX...jU.EE..UUY..j...
output:
250000 11332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332...
result:
ok 250000 unfolded couches
Test #20:
score: 0
Accepted
time: 71ms
memory: 71928kb
input:
958 1000 JJ..FFLL...iPP.vT.E..hGGUU..PP...f.....z.eKKW..h..C.ZZ..E.....HH.w.kYYQQ.fZZ..RRV......pRRY.Q...A.Z.TTE.L.KK.jU...GGK.D..r..K.PPAATTR..t.kNNL.XX.v.fDDXXJJ.tY...NN.h.q......TT.nF..zLL.hO.K.....II.iV...Q.SSPP.vOO.xW..z.lOOQQ..V.KKSS.....oAA.kWWPP.qJJ...j.m.s.qF.PPZZ.f.cA.W.WW..Y.X.H..p.rV...C...
output:
239500 11332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332...
result:
ok 239500 unfolded couches
Test #21:
score: 0
Accepted
time: 30ms
memory: 27644kb
input:
1000 1000 KPPARttRRttCJJKKiFJBBPlJJwwimmBwUvSSuEEpWlpggFrZwwRrrLLCxxBBlNoonnWWRqjkrrRRXAADDVeFFJJajkjjuumWppkkvQJYAAKVKKgXXuwBBDSSvdaSShFkkKKddEYymmggSnVPPbiuuHuMepooaggDUJJQQggXXccWWshhVbbTmsWWLLFFRWWMMccsVVCCpgNNttXeFFShCCvNoOuubkkMMYYKKssNNajjCkpgyggoJJvbbHsTTdZiiDrrooffDHMFFEEyyoAUmmttgbbmmffKKf...
output:
0 1221233221131133231221233221221231221221231221231131133233221233221131231133233221233221231133231133231233231131131221221231131221133231221131233231131231221221233221133221131131131233221131133221221131221131221233231233233221133221131131231221221221233231131133221231133221231133233221133233231131...
result:
ok 0 unfolded couches
Test #22:
score: 0
Accepted
time: 29ms
memory: 26812kb
input:
998 968 zMMmmiMzzmmlwjjBddZZPllErrvuccIaAAxxiiCCxxbbEEeCaaKKZnNrRrRTmmrrwwSSoPPvmIlhhmmugMMrrFylIIddWWbbhhbgkAaajbbIllggxRKZeeWWjjchHvNNFFnnxxwwFFzppMitoowwEVpkGDDxhhvMssiiBBJJmaahQQOOWFZZTggTTzMlAcacyyppVOOtssEwXXAAOOpprWqqmmhPWssCTTPPTeemcMMjjPPzzkkrTlrddzFUUEEyggUNccUJVVcqVneMddmmPPJJPXXBBSSaAyUe...
output:
0 1221131221131221221131131131221233221133221133231133231231231133221131131231133231133231221133221131231131131133231233221131231133221133221221231133231231131131221133221221221131221221131231231133233233231133221131221131233233221221233221133221231221233221221233231131231233221133233221131231133233...
result:
ok 0 unfolded couches
Test #23:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
6 6 ..aB.. ..aB.. cc..dd EExxFF ..gH.. ..gH..
output:
5 .2211. .2211. 779988 119922 .5544. .5544.
result:
ok 5 unfolded couches
Test #24:
score: 0
Accepted
time: 10ms
memory: 27576kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
12 .............22..33..11.....................................................................................................................................................................................................................................................................................
result:
ok 12 unfolded couches
Test #25:
score: 0
Accepted
time: 10ms
memory: 28444kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
1206 ..........................................................................................................................................................................................................................................................................................................
result:
ok 1206 unfolded couches
Test #26:
score: 0
Accepted
time: 19ms
memory: 40980kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
66719 .........................................................................................................................................................................................................................................................................................................
result:
ok 66719 unfolded couches
Test #27:
score: 0
Accepted
time: 19ms
memory: 38976kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
59162 .........................................................................................................................................................................................................................................................................................................
result:
ok 59162 unfolded couches
Test #28:
score: 0
Accepted
time: 20ms
memory: 41608kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
68173 .........................................................................................................................................................................................................................................................................................................
result:
ok 68173 unfolded couches
Test #29:
score: 0
Accepted
time: 23ms
memory: 37332kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
47990 .........................................................................................................................................................................................................................................................................................................
result:
ok 47990 unfolded couches
Test #30:
score: 0
Accepted
time: 23ms
memory: 42840kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
76478 .........................................................................................................................................................................................................................................................................................................
result:
ok 76478 unfolded couches
Test #31:
score: 0
Accepted
time: 33ms
memory: 44212kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
83323 .........................................................................................................................................................................................................................................................................................................
result:
ok 83323 unfolded couches
Test #32:
score: 0
Accepted
time: 35ms
memory: 42516kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
75246 .........................................................................................................................................................................................................................................................................................................
result:
ok 75246 unfolded couches
Test #33:
score: 0
Accepted
time: 41ms
memory: 44144kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
84824 .22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22......
result:
ok 84824 unfolded couches
Test #34:
score: 0
Accepted
time: 24ms
memory: 41584kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
67828 .22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22....22......
result:
ok 67828 unfolded couches
Test #35:
score: 0
Accepted
time: 24ms
memory: 38764kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
56603 ...11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....
result:
ok 56603 unfolded couches
Test #36:
score: 0
Accepted
time: 24ms
memory: 37540kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
48378 .........................................................................................................................................................................................................................................................................................................
result:
ok 48378 unfolded couches
Test #37:
score: 0
Accepted
time: 27ms
memory: 39464kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
60521 .........................................................................................................................................................................................................................................................................................................
result:
ok 60521 unfolded couches
Test #38:
score: 0
Accepted
time: 27ms
memory: 36176kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
42353 ...11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....11....
result:
ok 42353 unfolded couches
Test #39:
score: 0
Accepted
time: 75ms
memory: 89172kb
input:
1000 1000 .VVGGXXGGPPUUAAMMKKXXKKSSZZHHKKBBPPHHYYKKIINNKKEEZZPPLLVVFFJJAAQQMMOOPPOODDOOTTKKRRJJZZRRIIMMLLVVUUMMUUAARREENNEEXXCCFFYYCCEEBBEEUURRGGVVJJYYOOSSPPDDHHVVUUYYFFVVTTVVNNRRDDYYLLUUAACCVVRRAAYYGGWWNNPPNNZZIIJJDDIIFFYYEERRVVJJAAOOAALLCCGGXXOOVVLLDDQQFFZZAAOORRAAHHDDIIGGYYOOJJKKNNVVIIAAZZTTPPCCM...
output:
166114 .2211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211...
result:
ok 166114 unfolded couches
Test #40:
score: 0
Accepted
time: 80ms
memory: 89812kb
input:
1000 1000 .VVGGXXGGPPUUAAMMKKXXKKSSZZHHKKBBPPHHYYKKIINNKKEEZZPPLLVVFFJJAAQQMMOOPPOODDOOTTKKRRJJZZRRIIMMLLVVUUMMUUAARREENNEEXXCCFFYYCCEEBBEEUURRGGVVJJYYOOSSPPDDHHVVUUYYFFVVTTVVNNRRDDYYLLUUAACCVVRRAAYYGGWWNNPPNNZZIIJJDDIIFFYYEERRVVJJAAOOAALLCCGGXXOOVVLLDDQQFFZZAAOORRAAHHDDIIGGYYOOJJKKNNVVIIAAZZTTPPCCM...
output:
166114 .2211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211332211...
result:
ok 166114 unfolded couches
Test #41:
score: 0
Accepted
time: 101ms
memory: 88376kb
input:
1000 1000 ..vGGx.GG..pUUa.MMK..XKKSS.......................................................Z..HKKBB.P..PHHYY...kIIn.KK..eZZp.LL..vFFj.AAQ..MOOPP.O..DOOTT.K..RJJZZ...rIIm.LL..vUUm.UU..aRRe.NNE..XCCFF.Y..CEEBB.E..URRGG...vJJy.OO..sPPd.HH..vUUy.FFV..TVVNN.R..DYYLL.U..ACCVV...rAAy.GG..gWWn.PP..nZZi.JJD....
output:
166114 .22113.22.22113.2211.12211.......................................................11.12211.11.12211..22113.22.22113.22.22113.2211.12211.11.12211.11.12211..22113.22.22113.22.22113.2211.12211.11.12211.11.12211..22113.22.22113.22.22113.2211.12211.11.12211.11.12211..22113.22.22113.22.22113.2211.12...
result:
ok 166114 unfolded couches
Test #42:
score: 0
Accepted
time: 92ms
memory: 89100kb
input:
1000 1000 ..VVGGx..gPP.UAAM..KK.XKKS..ZZ.HKKB...PPHHy..k.IINNk..e.ZZPPl..vFF.JAAQ..MM.OPPO..DD.OTTK...RRJJz..r.IIMMl..v.UUMMu..aRR.ENNE..XX.CFFY..CC.EBBE...UURRg..v.JJYYo..s.PPDDh..vUU.YFFV..TT.VNNR..DD.YLLU...AACCv..r.AAYYg..g.WWNNp..nZZ.IJJD..II.FYYE..RR.VJJA...OOAAl..c.GGXXo..v.LLDDq..fZZ.AOOR..A...
output:
166114 ..33221.3322.23322.22.23322.22.23322..33221.33.33221.33.33221.3322.23322.22.23322.22.23322..33221.33.33221.33.33221.3322.23322.22.23322.22.23322..33221.33.33221.33.33221.3322.23322.22.23322.22.23322..33221.33.33221.33.33221.3322.23322.22.23322.22.23322..33221.33.33221.33.33221.3322.23322.22.2...
result:
ok 166114 unfolded couches
Test #43:
score: 0
Accepted
time: 68ms
memory: 88964kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
166114 ........................................................................................................................................................................................................................................................................................................
result:
ok 166114 unfolded couches
Test #44:
score: 0
Accepted
time: 71ms
memory: 88400kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
166114 ........................................................................................................................................................................................................................................................................................................
result:
ok 166114 unfolded couches
Test #45:
score: 0
Accepted
time: 87ms
memory: 89300kb
input:
1000 1000 ..VV.GG.XXGPPUAAMKKX..K..S...ZZ.HH.KKBPPHYYKIIN..K..E...ZZ.PP.LLVFFJAAQMMO..P..O...DD.OO.TTKRRJZZRIIM..L..V...UU.MM.UUARRENNEXXC..F..Y...CC.EE.BBEUURGGVJJY..O..S...PP.DD.HHVUUYFFVTTV..N..R...DD.YY.LLUAACVVRAAY..G..G...WW.NN.PPNZZIJJDIIF..Y..E...RR.VV.JJAOOALLCGGX..O..V...LL.DD.QQFZZAOORAAH...
output:
166114 ..33.33.3323323323322.22.22..33.33.3323323323322.22.22..33.33.3323323323322.22.22..33.33.3323323323322.22.22..33.33.3323323323322.22.22..33.33.3323323323322.22.22..33.33.3323323323322.22.22..33.33.3323323323322.22.22..33.33.3323323323322.22.22..33.33.3323323323322.22.22..33.33.3323323323322.2...
result:
ok 166114 unfolded couches
Test #46:
score: 0
Accepted
time: 98ms
memory: 90820kb
input:
1000 1000 ..v..g..xGGpUUaMMkXX.KK.SS...z..h..kBBpPPhYYkII.NN.KK...e..z..pLLvFFjAAqMM.OO.PP...o..d..oTTkRRjZZrII.MM.LL...v..u..mUUaRReNNeXX.CC.FF...y..c..eBBeUUrGGvJJ.YY.OO...s..p..dHHvUUyFFvTT.VV.NN...r..d..yLLuAAcVVrAA.YY.GG...g..w..nPPnZZiJJdII.FF.YY...e..r..vJJaOOaLLcGG.XX.OO...v..l..dQQfZZaOOrAA...
output:
166114 .22.22.2211311311311.11.11..22.22.2211311311311.11.11..22.22.2211311311311.11.11..22.22.2211311311311.11.11..22.22.2211311311311.11.11..22.22.2211311311311.11.11..22.22.2211311311311.11.11..22.22.2211311311311.11.11..22.22.2211311311311.11.11..22.22.2211311311311.11.11..22.22.2211311311311.11...
result:
ok 166114 unfolded couches
Test #47:
score: 0
Accepted
time: 70ms
memory: 66140kb
input:
1000 1000 .VVggXX.GGPPuuaa..MM.KKxxKK.SSzzhhkkBBpp.PP.HHYY.KK..II.NNKKeezz.PPLLVVFFjjAA.QQMM.OO.PP.OO..DDoottKK.rr.jj..ZZrr.IImm.LL.vvUU.mmUU.AARREENN.EEXXcc.ffyy...cc.EE.BB..eeuurr.GGVV.JJ.YYOOssppDDHHVVUUyyff..VV..ttVV..nnRRddYYLLuu.AAccvvRR.AAyygg.GG.WW.NN.ppnnZZii.jjddII...FFYY.eerr..vvjjaaooAAL...
output:
149234 .221133.33221133..11.113322.221133221133.33.3322.22..33.33221133.332211332211.1133.33.33.33..11332211.11.11..2211.1133.33.3322.2211.11332211.113322.2211...33.33.33..113322.2211.11.11332211332211332211..22..3322..332211332211.11332211.113322.22.22.22.22113322.221133...2211.1133..113322113322.2...
result:
ok 149234 unfolded couches
Test #48:
score: 0
Accepted
time: 83ms
memory: 66616kb
input:
1000 1000 v.g.X...G.P.u...a.M.k.X...k.......S...Z.H.k.B.............P...p.H.y.....K...................I.......n.....K.E...Z.p.l.v.F.J...a.Q...M...o.p.o.D.O.T.K.r.j.Z.R.........I.M...L.......V.u.m.u.A.R.....e.N...E.X...c...f.Y.c.E.B...e...u...R.......g.v.j.y.....O.s.P.D.....h...V...u.y.f.v.t.....V.n....
output:
149234 122.22..33233..11.122.22.22.......22..33233.33............22.22.233.....11..................33.....11.....2211..2332211.1133.33.33..11.113322.22113323322.2211........2211..22......1221133.3322...11.11..2211.11..22.233.3322.22..33...22.....33221133.....122.2211...33...22.2211332211.....233.......
result:
ok 149234 unfolded couches