CSES - Leirikisa 1 - Results
Submission details
Task:trener
Sender:Kuha
Submission time:2016-07-27 16:35:12 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.06 sdetails
#20.05 sdetails
#30.06 sdetails
#40.07 sdetails
#50.16 sdetails
#60.15 sdetails
#70.15 sdetails
#80.26 sdetails
#90.06 sdetails
#100.06 sdetails
#110.14 sdetails
#120.15 sdetails
#130.13 sdetails
#140.06 sdetails
#150.14 sdetails

Compiler report

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

Code

#include <bits/stdc++.h>
#define ll int//long long
#define INF 999999999
#define N (1<<17)
#define M 1000000007
#define C 6323

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 + 1) * s;
}

int main () {
  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;
  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)