QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#203452 | #2474. Art Transaction | PlentyOfPenalty# | AC ✓ | 12ms | 4060kb | C++20 | 10.4kb | 2023-10-06 17:33:26 | 2023-10-06 17:33:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
namespace mem {
enum OPER {
SUNS,
BIGGEST_BIRD,
FLOCK_PERIMETER,
HOUSE_VIEW_UP,
BLOCKS_3X3,
ANIMALS1,
FREEDOM,
CHUPACABRA,
PEAKS,
DRAKE_GRILL,
MINIMUM_FREQUENCY,
EMPTY_FIELDS,
ANIMALS2,
HOUSE_VIEW_DOWN,
GIRLL_DRAKE,
HOUSE_AND_GRILLS,
};
vector<OPER> opers = {
SUNS, //
BIGGEST_BIRD, //
FLOCK_PERIMETER, //
HOUSE_VIEW_UP, //
BLOCKS_3X3, //
ANIMALS1, //
FREEDOM, //
CHUPACABRA, //
PEAKS, //
DRAKE_GRILL, //
MINIMUM_FREQUENCY, //
EMPTY_FIELDS, //
ANIMALS2, //
HOUSE_VIEW_DOWN, //
GIRLL_DRAKE, //
HOUSE_AND_GRILLS, //
};
map<OPER, string> names = {
{SUNS, "SUNS"}, //
{BIGGEST_BIRD, "BIGGEST_BIRD"}, //
{FLOCK_PERIMETER, "FLOCK_PERIMETER"}, //
{HOUSE_VIEW_UP, "HOUSE_VIEW_UP"}, //
{BLOCKS_3X3, "BLOCKS_3X3"}, //
{ANIMALS1, "ANIMALS1"}, //
{FREEDOM, "FREEDOM"}, //
{CHUPACABRA, "CHUPACABRA"}, //
{PEAKS, "PEAKS"}, //
{DRAKE_GRILL, "DRAKE_GRILL"}, //
{MINIMUM_FREQUENCY, "MINIMUM_FREQUENCY"}, //
{EMPTY_FIELDS, "EMPTY_FIELDS"}, //
{ANIMALS2, "ANIMALS2"}, //
{HOUSE_VIEW_DOWN, "HOUSE_VIEW_DOWN"}, //
{GIRLL_DRAKE, "GIRLL_DRAKE"}, //
{HOUSE_AND_GRILLS, "HOUSE_AND_GRILLS"}, //
};
map<OPER, int> values = {
{SUNS, 100}, //
{BIGGEST_BIRD, 500}, //
{FLOCK_PERIMETER, 60}, //
{HOUSE_VIEW_UP, 10}, //
{BLOCKS_3X3, 1}, //
{ANIMALS1, 15}, //
{FREEDOM, 7}, //
{CHUPACABRA, 200}, //
{PEAKS, 50}, //
{DRAKE_GRILL, 500}, //
{MINIMUM_FREQUENCY, 10}, //
{EMPTY_FIELDS, 1}, //
{ANIMALS2, 1}, //
{HOUSE_VIEW_DOWN, 5}, //
{GIRLL_DRAKE, 50}, //
{HOUSE_AND_GRILLS, 3}, //
};
const int N = 55;
const int nxt[8][2] = {{1, 0}, {-1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1}, {1, -1}, {-1, 1}};
int n;
char a[N][N];
bool vis[N][N], checked[N][N], current[N][N], illuminated[N][N];
vector<pair<int, int>> indexs;
constexpr int absi(int x) { return x < 0 ? -x : x; }
bool is_border(int x, int y) { return x < 1 || y < 1 || x > n || y > n; }
bool is_empty(int x, int y) { return !is_border(x, y) && a[x][y] == ' '; }
bool is_chupacabra(int x, int y) { return !is_border(x, y) && a[x][y] == '!'; }
bool is_bird(int x, int y) { return !is_border(x, y) && (a[x][y] == 'v' || a[x][y] == 'D'); }
bool is_animal(int x, int y) { return !is_border(x, y) && (a[x][y] == '!' || a[x][y] == 'v' || a[x][y] == 'D'); }
int get(OPER op) {
int res = 0;
if (op == SUNS) {
for (const auto &[i, j] : indexs)
if (a[i][j] == '*') {
for (int t = 0; t < 8; t++) {
for (int x = i + nxt[t][0], y = j + nxt[t][1]; !is_border(x, y); x += nxt[t][0], y += nxt[t][1]) {
if (!is_empty(x, y)) {
illuminated[x][y] = true;
break;
}
}
}
}
for (const auto &[i, j] : indexs)
if (illuminated[i][j] && a[i][j] != '*') {
res++;
// cerr << "illuminated " << i << " " << j << endl;
}
} else if (op == BIGGEST_BIRD) {
for (const auto &[i, j] : indexs)
if (is_bird(i, j) && !checked[i][j]) {
queue<pair<int, int>> q;
q.push({i, j});
memset(current, 0, sizeof(current));
checked[i][j] = current[i][j] = true;
while (q.size()) {
auto [ux, uy] = q.front();
q.pop();
for (int i = 0; i < 4; i++) {
int vx = ux + nxt[i][0];
int vy = uy + nxt[i][1];
if (is_bird(vx, vy) && !checked[vx][vy]) {
checked[vx][vy] = current[vx][vy] = true;
q.push({vx, vy});
}
}
}
int mx = 0;
for (int i = 1; i <= n; i++)
for (int l = 1, r = 1; l <= n; l = r + 1, r = l) {
if (!current[i][l]) continue;
while (r + 1 <= n && current[i][r + 1]) ++r;
mx = max(mx, r - l + 1);
}
// for (int j = 1; j <= n; j++)
// for (int l = 1, r = 1; l <= n; l = r + 1, r = l) {
// if (!current[l][j]) continue;
// while (r + 1 <= n && current[r + 1][j]) ++r;
// mx = max(mx, r - l + 1);
// }
res += mx;
}
} else if (op == FLOCK_PERIMETER) {
for (const auto &[i, j] : indexs)
if (is_bird(i, j)) {
int cur = 0;
cur += !is_bird(i - 1, j);
cur += !is_bird(i + 1, j);
cur += !is_bird(i, j - 1);
cur += !is_bird(i, j + 1);
res += cur;
}
} else if (op == HOUSE_VIEW_UP) {
for (const auto &[i, j] : indexs)
if (a[i][j] == '^') {
for (int k = i - 1; k >= 1; k--)
if (a[k][j] == ' ') {
++res;
} else {
break;
}
}
} else if (op == BLOCKS_3X3) {
set<tuple<char, char, char, char, char, char, char, char, char>> st;
for (int i = 1; i + 2 <= n; i++)
for (int j = 1; j + 2 <= n; j++) {
st.insert(make_tuple(a[i + 0][j + 0], //
a[i + 1][j + 0], //
a[i + 2][j + 0], //
a[i + 0][j + 1], //
a[i + 1][j + 1], //
a[i + 2][j + 1], //
a[i + 0][j + 2], //
a[i + 1][j + 2], //
a[i + 2][j + 2]));
}
res = (int)st.size();
} else if (op == ANIMALS1) {
for (const auto &[i, j] : indexs)
if (is_animal(i, j)) {
res += is_empty(i - 1, j);
res += is_empty(i + 1, j);
res += is_empty(i, j - 1);
res += is_empty(i, j + 1);
}
} else if (op == FREEDOM) {
auto is_freedom = [&](int x, int y) {
queue<pair<int, int>> q;
memset(vis, 0, sizeof(vis));
q.push({x, y});
vis[x][y] = true;
while (q.size()) {
auto [ux, uy] = q.front();
q.pop();
for (int i = 0; i < 4; i++) {
int vx = ux + nxt[i][0];
int vy = uy + nxt[i][1];
if (is_border(vx, vy)) return true;
if (is_empty(vx, vy) && !vis[vx][vy]) {
vis[vx][vy] = true;
q.push({vx, vy});
}
}
}
return false;
};
for (const auto &[i, j] : indexs) {
if (a[i][j] != ' ') {
if (is_freedom(i, j)) {
++res;
}
}
// cerr << (a[i][j] != ' ' && is_freedom(i, j)) << " \n"[j == n];
}
} else if (op == CHUPACABRA) {
for (const auto &[i, j] : indexs)
if (is_bird(i, j)) {
bool fl = false;
if (is_chupacabra(i - 1, j - 2)) fl = true;
if (is_chupacabra(i + 1, j - 2)) fl = true;
if (is_chupacabra(i - 1, j + 2)) fl = true;
if (is_chupacabra(i + 1, j + 2)) fl = true;
if (is_chupacabra(i - 2, j - 1)) fl = true;
if (is_chupacabra(i + 2, j - 1)) fl = true;
if (is_chupacabra(i - 2, j + 1)) fl = true;
if (is_chupacabra(i + 2, j + 1)) fl = true;
if (fl) {
++res;
}
}
} else if (op == PEAKS) {
vector<pair<int, int>> p;
for (const auto &[i, j] : indexs)
if (a[i][j] == '/' && j + 1 <= n && a[i][j + 1] == '\\') {
p.emplace_back(i, j);
}
if (p.size() < 2) return 0;
for (const auto &[i, j] : p) {
int cur = 0;
for (const auto &[x, y] : p) cur = max(cur, absi(x - i) + absi(y - j));
// cerr << "peaks " << i << " " << j << " :: " << cur << endl;
res += cur;
}
} else if (op == DRAKE_GRILL) {
for (const auto &[i, j] : indexs)
if (a[i][j] == 'D') {
bool fl = false;
if (!is_border(i - 1, j) && a[i - 1][j] == 'G') fl = true;
if (!is_border(i + 1, j) && a[i + 1][j] == 'G') fl = true;
if (!is_border(i, j - 1) && a[i][j - 1] == 'G') fl = true;
if (!is_border(i, j + 1) && a[i][j + 1] == 'G') fl = true;
if (fl) {
++res;
}
}
} else if (op == MINIMUM_FREQUENCY) {
map<char, int> mp;
for (const auto &[i, j] : indexs)
if (a[i][j] != ' ') {
++mp[a[i][j]];
}
int mn = INT_MAX;
for (const auto &[x, y] : mp) {
mn = min(mn, y);
}
for (const auto &[x, y] : mp) {
if (y == mn) res += y;
}
} else if (op == EMPTY_FIELDS) {
for (const auto &[i, j] : indexs) {
if (a[i][j] == ' ') ++res;
}
} else if (op == ANIMALS2) {
int cnt[] = {0, 0, 0};
for (const auto &[i, j] : indexs) {
if (a[i][j] == '!') ++cnt[0];
if (a[i][j] == 'v') ++cnt[1];
if (a[i][j] == 'D') ++cnt[2];
}
res = cnt[0] * cnt[1] * cnt[2];
} else if (op == HOUSE_VIEW_DOWN) {
return get(HOUSE_VIEW_UP);
} else if (op == GIRLL_DRAKE) {
for (const auto &[i, j] : indexs) {
if (a[i][j] == 'D') {
a[i][j] = 'G';
} else if (a[i][j] == 'G') {
a[i][j] = 'D';
}
}
res = get(DRAKE_GRILL);
for (const auto &[i, j] : indexs) {
if (a[i][j] == 'D') {
a[i][j] = 'G';
} else if (a[i][j] == 'G') {
a[i][j] = 'D';
}
}
} else if (op == HOUSE_AND_GRILLS) {
int cnt[] = {0, 0};
for (const auto &[i, j] : indexs) {
if (a[i][j] == '^') ++cnt[0];
if (a[i][j] == 'G') ++cnt[1];
}
res = min(cnt[0], cnt[1]);
}
return res;
}
} // namespace mem
int main() {
#ifdef memset0
freopen("A.in", "r", stdin);
#endif
using namespace mem;
ios::sync_with_stdio(0), cin.tie(0);
string str;
cin >> n, getline(cin, str);
for (int i = 1; i <= n; i++) {
getline(cin, str);
for (int j = 1; j <= n; j++) {
a[i][j] = str[j - 1];
indexs.emplace_back(i, j);
}
}
long long ans = 0;
for (OPER op : opers) {
int cnt = get(op);
cerr << names[op] << ": " << cnt << " * " << values[op] << endl;
ans += (long long)cnt * values[op];
}
cout << ans << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3876kb
input:
2 / ^G
output:
70
result:
ok single line: '70'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
3 ^v* v/ / v
output:
2017
result:
ok single line: '2017'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
3 v \D^ ^/\
output:
1607
result:
ok single line: '1607'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
3 *D* /G \/!
output:
2003
result:
ok single line: '2003'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
3 G G D \ /!*
output:
1722
result:
ok single line: '1722'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
9 *^!/\vDG *^!/\vDG *^!/\vDG *^!/\vDG *^!/\vDG *^!/\vDG *^!/\vDG *^!/\vDG *^!/\vDG
output:
12672
result:
ok single line: '12672'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
3 *** *** ***
output:
147
result:
ok single line: '147'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
3 !!! *!! !!!
output:
567
result:
ok single line: '567'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
3 v vvv v
output:
2423
result:
ok single line: '2423'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
3 v v v
output:
1128
result:
ok single line: '1128'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
3 vvv
output:
2128
result:
ok single line: '2128'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
3 D DDD D
output:
2423
result:
ok single line: '2423'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
3 D vDv D
output:
2393
result:
ok single line: '2393'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
3 v v D D
output:
3154
result:
ok single line: '3154'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
3
output:
10
result:
ok single line: '10'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
3 v D !
output:
1659
result:
ok single line: '1659'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
3 ! ! v
output:
1083
result:
ok single line: '1083'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
3 ! ! D
output:
1083
result:
ok single line: '1083'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
3 /\ /\
output:
374
result:
ok single line: '374'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
3 GD G
output:
1393
result:
ok single line: '1393'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
3 DG D
output:
2628
result:
ok single line: '2628'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
3 *^ /\ vDG
output:
2350
result:
ok single line: '2350'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3
output:
10
result:
ok single line: '10'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
3 G^^ G^^ G^G
output:
109
result:
ok single line: '109'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
5 /*G\ D^*v */D !/!* D^D*
output:
4946
result:
ok single line: '4946'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
10 ///\*/G*^\ ^*/*!\//G G\/ GG/ D/ //\vDv!D! !G*D*Gv/vv D G/D*D/D\ /v!v^DG \v v^v/^/v*v\ G!G /v*v^G //^^vv/G^/
output:
25134
result:
ok single line: '25134'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
15 !\*\v/^\GD G^\ DDD^G!^\G^^! *G D^ vDv \G/Gvv ^!**\^\!*^ vD/\ G\GG/G/ *vvv\vG !/\\^/\*/ !D*G ^^^*\ G\G^D^ ! *\\/G G\ D^/*\! ^v^! \/ GDD^!/* v/\\D!/ ^ ^ DG/ / /G^G\ /*//\ * !/*G*!/v!!GG*GG !^G^G G^ vvvDv D^!!\ GGG/*\\^/ ^Dv^vDv/*\^^!GD
output:
54923
result:
ok single line: '54923'
Test #28:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
20 ^^vv/*v/ *^^D*//GGv /GvGDGDG*v\/Dv^^/DG\ / v DvD*DDD /DD!v\^ G\^ v/GG!!!v^G*G D\v \!v^*!/**/*!!v!/\//D v!/ \v\vv D !vv\*D!^ DD\*/Gv/*GGD^DD!v!*G \Dv!^*^Gv !^!D\ !D!! *^D!^D\/*!!/DDD!\^DD v^\\\v G \/Gv/^!^!\ !Gv/**G\*!\DG^ /GDv\ /^\G!/D G ^ !*Dv G^* \D^\^\*\ ^v^ G*!GDDD \ !\!G\ D*G\G! ^v^vv / !...
output:
263008
result:
ok single line: '263008'
Test #29:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
25 /v/ ^G*D ! \*v^v D/*! \v ^^*! /!G*\/G/\G/vDG*\ Dv GG *GG^DD\v/* /! GG /!DDD /D!^vv/!!\\ !//!^/D*!*vv\ vG\DGD!/*DD ^DG/v/^Gv ! !/!!/\\*!!!/Gv *\G^ G^G G /G/^!v/\v\G /!\GG//^ \D^ \/^* vv!*Gv^**!**Gv\^G*/! Gv*/\! v\!^\*/DD^ GvGv! //*v!!vD^ \\D*GG\vv!!*GD/ G\!D*\*^//^ !\D!D\\ v/!/ GGG\*v\* !^...
output:
476332
result:
ok single line: '476332'
Test #30:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
30 !!\^*DDG!^v *!^^D*vD^!*!D^/G\ /v*GGD!*v//!!v!^^G/GD!!G D*\\D !^ ^ /\*/\!/ *^ vv/*D!\ ^ \ !v /Gvv^ /D * !D**vv/v!* ! D vG \v!D\*/D* vD \GG\^ v^ ^^v^/\!^ ^G G/v!\/ vv/! D!!^vG*/*v/D D ** *\ DDGDG*/v^^ !*/ ^^/*/G^! ^*^GD*D*/*GD/\ ^//\\**GD*GGvD ^G^ DD^DD^* vv**v D/vG*/DG*/// /^DG^v/*/v**^ *!^\...
output:
1223508
result:
ok single line: '1223508'
Test #31:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
35 *Dvv*D!G *v\/ **\!/G\*v *\\v \!Dv^* ^* !\vG!GD/*^\^/\//^ D*GGG^GG*!G* \vD/G!*^/D!\\ !vvD **D\/ v/\v^GvDD* \^^G/G*!*G^D^D*DG^ /^^*\!*DDvv!/ ^^ ^\vv/\Dv!GG!*\\v!!GD!GGGDDG\\v*^!\/ v//! //G v ^^GDG^**D*D\DD\*^ *^^/v GGGvDG\D/v! \ *!D! G//D\!^ v^GD/D v\!^ \!v*/^vG*GD^D/\/vD/\**^ G^DGv ^ ^vvD G...
output:
2548495
result:
ok single line: '2548495'
Test #32:
score: 0
Accepted
time: 1ms
memory: 4024kb
input:
40 *DvG**G^/ !^G^ ^\\/v!GD Dv vv!DD*/*G!!! v\vD!G/G^vG*D^\*^!\/** D*!D/\**! **/\^ *D/G\D v^v!/^GG^v^Gv*G\G *\ GGD G/D!G* /v! ^/G \/GDvv vvG\\^D v^!*G!DD/*v/*vD/D v*D/G!\*^!*G/\v^ /Dv *v!!DvD*!\GG/!G//v/ DG*^v/^!/\^D\\G//\*DDG v \^^ v *D\v!^D!v !^*!G\ *D*^v*\D/*^G^\D!!D* !!^//*/vv G^ GG!!****\D...
output:
6207683
result:
ok single line: '6207683'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
45 !D*/^v/^^/!**Gv/G\^D* */vD^vDD Gv\*!! /* D\\v //vv**vv v^!!v*^**v\!\G *^ *G*//D vDvGG^*G!!^ /v^* *DD!!^G^^v^/ ^^vDDG/Dv\v*\\v!/* * /^/D* !GDD*\v!DD^/G/^^Gv* ^DG/G\GD\D\G ^\*/ ^/D*D v*\\!G\*v^ !^^*//\*/^D!^v\\ G\^*^ D/**!GGG/G v GD v\ \^DvG*\ ^!\ !^\*/DvGv\ G*G ^^GDv^/^ !GDv* \D!**!!\ /G/G ^...
output:
12283068
result:
ok single line: '12283068'
Test #34:
score: 0
Accepted
time: 2ms
memory: 4060kb
input:
50 D*^\G/*/G\GDD !!\v\vDDv^!D\*//**v//\\\/// v\G^Gv\v *D/\\ vv\Gv/\/G!/*!vG!/^\//!*\!^!^^v**!G*DG\G/ G^ \ /D*D*/!\!^^ ^ v^\\D\ !\* ^vG!/\v/*Gv\D^* !Gv\v/ v\ * DvG\!! ! /\ */G /^ G!^! * \^vG^D\ \v*//DD!* ! D/^D^GvG //*v !^^ /^!!\ Gvv^G!vDv/G*/D* ^\\^ v!*!\ DDG*D\^*\/ \!\ ^^DG\\vG!*! \Gvv*/^D\G\ /^/...
output:
20833314
result:
ok single line: '20833314'
Test #35:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
50 * D * * D * * D * * D * * D * * D ...
output:
54097
result:
ok single line: '54097'
Test #36:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
50 vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...
output:
63373
result:
ok single line: '63373'
Test #37:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
50 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD D ...
output:
237418
result:
ok single line: '237418'
Test #38:
score: 0
Accepted
time: 4ms
memory: 3628kb
input:
50 vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv v v v vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv v v v v v v v vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv v v v v v ...
output:
376604
result:
ok single line: '376604'
Test #39:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
50 ...
output:
40052
result:
ok single line: '40052'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
50 !Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!D Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv v!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv! !Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!D Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv v!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!D...
output:
579291261
result:
ok single line: '579291261'
Test #41:
score: 0
Accepted
time: 1ms
memory: 3952kb
input:
50 /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\...
output:
4618874
result:
ok single line: '4618874'
Test #42:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
50 GGGDGGDGDDGDDDDDDDGGDDDDGDGDGGDDDDDDGGDDGDGDDDDGGG DDGGDGGDDDGDGDDDDGGDGDDDDGGDDGGGGGDGDDGDDGGDGGGGGD GDDGGGDGDGGDDGGGGDDDGDDDDDGGDGDGGDDGDDDGGGDGGDGGDD GGGDDGDGGDGGGGGGDGDGGDDDGGGDGDDGGGDDDGDDGDDGDDGDGG GDGDGGGGDDGGGDDGGDDGGGDDGGDDGDDGGGDDGDDGGDDDGGGGGG GGDGGGGDDGGGDGGGDDGGGGDDGGGGGGDGGDGDDGGGDG...
output:
1006558
result:
ok single line: '1006558'
Test #43:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
50 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...
output:
1491874
result:
ok single line: '1491874'
Test #44:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
50 ...
output:
2501
result:
ok single line: '2501'
Test #45:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
50 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG G^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^ GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG G^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^ GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...
output:
5138
result:
ok single line: '5138'
Test #46:
score: 0
Accepted
time: 3ms
memory: 3720kb
input:
50 D^ DD /v ^^ GG DD \/ Gv GD !/ \\ !D / ^v !/ /! \ ...
output:
404545
result:
ok single line: '404545'
Test #47:
score: 0
Accepted
time: 2ms
memory: 3796kb
input:
50 /*D/!^^v\^^\\^D**GD\\DGG\/^/vG!D!\/!D^GD*\\vD/GvG\ ^**/^\!*/*D!Dv*/\*!^^!\v\^Gv/*^G\GG//G^v!*!!D^^v/v !G*G\G!!!vv^\vG*GvDG*\D/^D/^/D/v*\!*!!GG/!G\DG^*D\ v*G*v*//*!!\/!^\\^**^DGDDG!v!DDv^\!/DGvv/\\/^\DDG* ...
output:
10613183
result:
ok single line: '10613183'
Test #48:
score: 0
Accepted
time: 12ms
memory: 3744kb
input:
50 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD D D D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD D D D D D D D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD D D D D D ...
output:
240349
result:
ok single line: '240349'
Test #49:
score: 0
Accepted
time: 3ms
memory: 3792kb
input:
50 /D \v *! G\ v! Gv ^v D^ ^G DD ^^ !/ */ G^ ^! D* \D !! \/ \! ^^ *^ G! !^ G/ *\ !^ \D v! */ GG DD vD *v G! Gv *D \^ !^ D^ vG GD ^! G^ \! !* *v *G D^ !^ *v v^ !\ ^^ /! v* G/ \v G/ D! v* // ^! v* !\ \/ */ !/ ...
output:
3630584
result:
ok single line: '3630584'
Test #50:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
3 ! v D
output:
2059
result:
ok single line: '2059'