Task: | ratar |
Sender: | Kuha |
Submission time: | 2016-07-27 16:45:07 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.05 s | details |
#3 | ACCEPTED | 0.06 s | details |
#4 | ACCEPTED | 0.06 s | details |
#5 | ACCEPTED | 0.06 s | details |
#6 | ACCEPTED | 0.05 s | details |
#7 | ACCEPTED | 0.05 s | details |
#8 | ACCEPTED | 0.09 s | details |
#9 | WRONG ANSWER | 0.30 s | details |
#10 | RUNTIME ERROR | 0.19 s | details |
#11 | RUNTIME ERROR | 0.20 s | details |
#12 | RUNTIME ERROR | 0.15 s | details |
#13 | RUNTIME ERROR | 0.21 s | details |
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 15133using namespace std;ll ans = 0;ll v[52][52];ll m[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);}}}}random_shuffle(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]++;}}}}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];}}}}for (ll y = 0; y < n; y++) for (ll x = 0; x< n; x++) for (ll i = 0; i < C; i++) m[y][x][i] = 0;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[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[y1][x + 1][s];}}}}cout<<ans<<endl;}
Test details
Test 1
Verdict: ACCEPTED
input |
---|
3
1 2 3 2 3 4 3 4 8 |
correct output |
---|
7 |
user output |
---|
7 |
Test 2
Verdict: ACCEPTED
input |
---|
4
-1 -1 -1 -1 1 2 3 4 1 2 3 4 1 2 3 4 |
correct output |
---|
10 |
user output |
---|
10 |
Test 3
Verdict: ACCEPTED
input |
---|
5
-1 -1 -1 -1 -1 -2 -2 -2 -2 -2 -3 -3 -3 -3 -3 -4 -4 -4 -4 -4 ... |
correct output |
---|
36 |
user output |
---|
36 |
Test 4
Verdict: ACCEPTED
input |
---|
2
1 -1 -1 1 |
correct output |
---|
2 |
user output |
---|
2 |
Test 5
Verdict: ACCEPTED
input |
---|
5
1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 ... |
correct output |
---|
380 |
user output |
---|
380 |
Test 6
Verdict: ACCEPTED
input |
---|
10
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 0 ... |
correct output |
---|
7354 |
user output |
---|
7354 |
Test 7
Verdict: ACCEPTED
input |
---|
10
420 425 490 727 888 391 514 82... |
correct output |
---|
5 |
user output |
---|
5 |
Test 8
Verdict: ACCEPTED
input |
---|
31
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
correct output |
---|
667480 |
user output |
---|
667480 |
Test 9
Verdict: WRONG ANSWER
input |
---|
41
475 533 -726 -189 401 -389 667... |
correct output |
---|
17456 |
user output |
---|
27949 |
Test 10
Verdict: RUNTIME ERROR
input |
---|
49
495 -512 159 -874 751 -817 567... |
correct output |
---|
48443 |
user output |
---|
(empty) |
Test 11
Verdict: RUNTIME ERROR
input |
---|
49
521 -51 -778 -977 955 -172 695... |
correct output |
---|
39082 |
user output |
---|
(empty) |
Test 12
Verdict: RUNTIME ERROR
input |
---|
50
500 500 500 500 500 500 500 50... |
correct output |
---|
4236645 |
user output |
---|
(empty) |
Test 13
Verdict: RUNTIME ERROR
input |
---|
50
933 -493 -881 936 -889 -922 -5... |
correct output |
---|
37917 |
user output |
---|
(empty) |