Submission details
Task:trener
Sender:Kuha
Submission time:2016-07-27 16:38:24 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.06 sdetails
#20.06 sdetails
#30.05 sdetails
#40.06 sdetails
#50.15 sdetails
#60.14 sdetails
#70.14 sdetails
#80.15 sdetails
#90.06 sdetails
#100.06 sdetails
#110.15 sdetails
#120.14 sdetails
#130.15 sdetails
#140.06 sdetails
#150.15 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:54:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < foo.size(); i++) e[foo[i]] = (i + (rand() % 10)) % C;
                                ^

Code

#include <bits/stdc++.h>
#define ll int//long long
#define INF 999999999
#define N (1<<17)
#define M 1000000007
#define C 6133
using namespace std;
ll ans = 0;
ll v[52][52];
ll m[52][52][C];
ll m2[52][52][C];
unordered_map<ll, int> e;
vector<ll> foo;
const inline ll sum (const ll x1, const ll x2, const ll y1, const ll y2) {
ll s = v[y2][x2];
if (x1) s -= v[y2][x1-1];
if (y1) s -= v[y1-1][x2];
if (x1 && y1) s += v[y1-1][x1-1];
return s;
}
int main () {
srand(time(0));
cin.sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
for (int y = 0; y < n; y++) {
for (int x = 0; x <n; x++) {
cin>>v[y][x];
//v[y][x] = 1;
if (x) v[y][x] += v[y][x - 1];
}
}
for(int y = 1; y < n; y++) {
for (int x = 0; x < n; x++) {
v[y][x] += v[y - 1][x];
}
}
for (ll y = 0; y < n; y++) {
for (ll x = 0; x <n; x++) {
for (ll y1 = 0; y1 <= y; y1++) {
for (ll x1 = 0; x1 <= x; x1++) {
ll s = sum(x1, x, y1, y);
if (!e[s]) e[s] = 1, foo.push_back(s);
}
}
}
}
sort(foo.begin(), foo.end());
for (int i = 0; i < foo.size(); i++) e[foo[i]] = (i + (rand() % 10)) % C;
for (ll y = 0; y < n; y++) {
for (ll x = 0; x <n; x++) {
for (ll y1 = 0; y1 <= y; y1++) {
for (ll x1 = 0; x1 <= x; x1++) {
ll s = e[sum(x1, x, y1, y)] % C;
m[y1][x1][s]++;
m2[y + 1][x1][s]++;
}
}
}
}
for (ll y = 0; y < n; y++) {
for (ll x = 0; x <n; x++) {
for (ll y1 = 0; y1 <= y; y1++) {
for (ll x1 = 0; x1 <= x; x1++) {
ll s = e[sum(x1, x, y1, y)] % C;
ans += m[y + 1][x + 1][s];
ans += m2[y1][x + 1][s];
}
}
}
}
cout<<ans<<endl;
}

Test details

Test 1

Verdict:

input
18
babic
keksic
boric
bukic
...

correct output
bk

user output
1877922

Test 2

Verdict:

input
6
michael
jordan
lebron
james
...

correct output
PREDAJA

user output
2450

Test 3

Verdict:

input
10
wmyrsaney
raqdxrb
cnwkmtcokgskaxosctzyks
wlusaisfibbkwwzdqhezuj
...

correct output
w

user output
54450

Test 4

Verdict:

input
20
jgztazpytubijfsmjz
bokvgratzzdibku
qineboilzoqdqivc
bfctyltibtkbxq
...

correct output
b

user output
3537800

Test 5

Verdict:

input
50
wkrtpgfjmzlnqigogi
knqkkelytfjgmyxgyzcfd
xdkjrptlcuzwqgvrtzdbybh
vscbjbji
...

correct output
efv

user output
867361250

Test 6

Verdict:

input
100
cmksprocpmkl
deyorcxeehlalonan
tdoqxhvygiwbbklj
rvamqpuprhynwduswppa
...

correct output
dfqrt

user output
(empty)

Test 7

Verdict:

input
130
assootmfjtgcagtxh
elqyysidg
otuxclnjhvxdadm
qmczmsgavvcboahqilzcuzm
...

correct output
abcdefghijklmnopqrstuvwxyz

user output
(empty)

Test 8

Verdict:

input
60
ljuolrxkieqkobvikuyvt
rhbrswllwycioayqjdertvb
xmzcubmbbed
uwgjslybqarciupgixt
...

correct output
eflmnr

user output
(empty)

Test 9

Verdict:

input
5
pnmdjqteyiapkhvebbqtwnnh
pirfyzgoqjsdsio
pkcltfhwxemgyubef
pxcjeh
...

correct output
p

user output
800

Test 10

Verdict:

input
20
fnuxegvwdqnkmkclmwlxeh
kmurkl
rlhxoacqadnzle
foxonevsx
...

correct output
PREDAJA

user output
3537800

Test 11

Verdict:

input
81
pidkcuqljmxi
mcpwm
zyyjrvkkkwkabwppvpm
aoighmgashjtvl
...

correct output
cegiptuwx

user output
(empty)

Test 12

Verdict:

input
100
evyottlutpqus
openmtwnmme
yvtgrk
shhpzhlgmpnnvswcpmjqiwe
...

correct output
PREDAJA

user output
(empty)

Test 13

Verdict:

input
99
yuqgzaqmnwrghzntlv
mcjkwfrkzchiauues
uclswdwkhtvkcsvklyhyiw
tggmfkr
...

correct output
abeklmnqtvz

user output
(empty)

Test 14

Verdict:

input
4
kzyulnmhnmkowhtgrqksru
xkgzlbwihowzdaodfg
nvxkdrltxviwyhkf
npvivwibxwrludfouga

correct output
PREDAJA

user output
200

Test 15

Verdict:

input
78
qdidvlkgpxjxmuqq
kgbugcncxazixwtxtww
abwtlqxkrusaocu
esjmgrutkzebklqt
...

correct output
ajlstxz

user output
(empty)