QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#649225#8860. Pirate Chestgarlic_MWTAC ✓420ms4852kbC++172.1kb2024-10-17 22:09:022024-10-17 22:09:03

Judging History

你现在查看的是最新测评结果

  • [2024-10-17 22:09:03]
  • 评测
  • 测评结果:AC
  • 用时:420ms
  • 内存:4852kb
  • [2024-10-17 22:09:02]
  • 提交

answer

#include <bits/stdc++.h>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define rep(i, a, b) for (auto i = (a); i < (b); i++)
#define each(x, a) for (auto& x: a)

#define debug if constexpr (xdebug) cout << "[DEBUG] "

#ifndef ONLINE_JUDGE
constexpr bool xdebug = true;
#else
constexpr bool xdebug = false;
#endif

int table[500][500];
void update_ans(int width, int N, int A, int B, int row, ll container_area, ll& ans) {
    if(width > B) return;
    stack<int> temp_stk;
    rep(i, 0, N) {
        while(!temp_stk.empty()) {
            int temp_ht = table[row][temp_stk.top()];
            if(temp_ht <= table[row][i]) break;
            temp_stk.pop();
            int length = i - 1 - (temp_stk.empty() ? -1 : temp_stk.top());
            length = min(length, (width > A ? A : B));
            ll area = width * length;
            ans = max(ans, (container_area * temp_ht - 1) / (container_area - area) * area);
        }
        temp_stk.push(i);
    }
    while(!temp_stk.empty()) {
        int temp_ht = table[row][temp_stk.top()];
        temp_stk.pop();
        int length = N - 1 - (temp_stk.empty() ? -1 : temp_stk.top());
        length = min(length, (width > A ? A : B));
        ll area = width * length;
        ans = max(ans, (container_area * temp_ht - 1) / (container_area - area) * area);
    }
}

void solve(int testcase){
    int A, B, M, N;
    cin >> A >> B >> M >> N;
    if(A > B) swap(A, B);
    rep(i, 0, M) rep(j, 0, N) cin >> table[i][j];
    ll ans = 0, container_area = M * N;
    rep(i, 0, M) {
        rep(j, 0, M - i) update_ans(i + 1, N, A, B, j, container_area, ans);
        rep(j, 0, M - i - 1) rep(k, 0, N) table[j][k] = min(table[j][k], table[j+1][k]);
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    clock_t st = clock();
    int t = 1;
    // cin >> t;
    rep(tc, 0, t) solve(tc);
    clock_t ed = clock();
    if(xdebug) {cout << '\n'; debug << ed - st << "ms\n";}
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3620kb

input:

3 1 2 3
2 1 1
2 2 1

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

4 1 1 5
2 0 2 2 2

output:

12

result:

ok single line: '12'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3884kb

input:

2 3 3 5
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2

output:

18

result:

ok single line: '18'

Test #4:

score: 0
Accepted
time: 420ms
memory: 4660kb

input:

499 499 500 500
649850711 869750238 627745405 930778599 956785748 598310756 998020082 659182553 889106939 905912562 606533068 765367617 509331841 519356700 778167157 675754469 808581870 911021086 521336619 618984603 786647531 902669308 804488018 755969003 609652761 767290830 624502151 628733548 9473...

output:

31156455008500822

result:

ok single line: '31156455008500822'

Test #5:

score: 0
Accepted
time: 378ms
memory: 4832kb

input:

499 499 500 500
999999999 1000000000 999999999 1000000000 1000000000 999999999 1000000000 999999999 1000000000 1000000000 999999999 1000000000 999999999 999999999 1000000000 999999999 1000000000 1000000000 999999999 999999999 1000000000 1000000000 1000000000 1000000000 999999999 1000000000 999999999...

output:

62312562500000999

result:

ok single line: '62312562500000999'

Test #6:

score: 0
Accepted
time: 380ms
memory: 4652kb

input:

499 499 500 500
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...

output:

62312562562500250

result:

ok single line: '62312562562500250'

Test #7:

score: 0
Accepted
time: 257ms
memory: 4660kb

input:

499 499 500 500
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999...

output:

62297015702750313

result:

ok single line: '62297015702750313'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

1 1 2 2
0 0
0 0

output:

0

result:

ok single line: '0'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

1 1 2 2
0 1000000000
0 0

output:

1333333333

result:

ok single line: '1333333333'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

1 1 2 2
1 1
1 1

output:

1

result:

ok single line: '1'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

1 1 2 2
2 2
4 2

output:

5

result:

ok single line: '5'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

1 1 2 2
4 4
4 2

output:

5

result:

ok single line: '5'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

1 1 2 2
1 2
3 4

output:

5

result:

ok single line: '5'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

3 2 3 4
1 1 1 1
1 0 1 1
1 1 1 1

output:

6

result:

ok single line: '6'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

3 2 4 3
1 1 1
1 0 1
1 1 1
1 1 1

output:

6

result:

ok single line: '6'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

3 3 4 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4

output:

36

result:

ok single line: '36'

Test #17:

score: 0
Accepted
time: 2ms
memory: 3988kb

input:

30 48 120 31
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 10...

output:

2348640

result:

ok single line: '2348640'

Test #18:

score: 0
Accepted
time: 2ms
memory: 4088kb

input:

30 48 120 31
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 10...

output:

2348640

result:

ok single line: '2348640'

Test #19:

score: 0
Accepted
time: 20ms
memory: 4852kb

input:

22 263 472 31
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000
1000000 1000000 1000000 1000000 100000...

output:

9570506880

result:

ok single line: '9570506880'

Test #20:

score: 0
Accepted
time: 19ms
memory: 4540kb

input:

263 22 472 31
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000
1000000 1000000 1000000 1000000 100000...

output:

9570506880

result:

ok single line: '9570506880'

Test #21:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

2 15 110 31
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10...

output:

30266272170

result:

ok single line: '30266272170'

Test #22:

score: 0
Accepted
time: 1ms
memory: 3896kb

input:

15 2 110 31
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10...

output:

30266272170

result:

ok single line: '30266272170'

Test #23:

score: 0
Accepted
time: 41ms
memory: 4780kb

input:

123 66 442 124
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

9522414

result:

ok single line: '9522414'

Test #24:

score: 0
Accepted
time: 41ms
memory: 4428kb

input:

123 66 442 124
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

9522414

result:

ok single line: '9522414'

Test #25:

score: 0
Accepted
time: 3ms
memory: 4184kb

input:

64 40 150 124
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...

output:

2968576000

result:

ok single line: '2968576000'

Test #26:

score: 0
Accepted
time: 7ms
memory: 4212kb

input:

64 40 150 124
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...

output:

2968576000

result:

ok single line: '2968576000'

Test #27:

score: 0
Accepted
time: 2ms
memory: 3736kb

input:

32 54 56 124
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1...

output:

2300466256704

result:

ok single line: '2300466256704'

Test #28:

score: 0
Accepted
time: 2ms
memory: 3868kb

input:

54 32 56 124
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1...

output:

2300466256704

result:

ok single line: '2300466256704'

Test #29:

score: 0
Accepted
time: 65ms
memory: 4036kb

input:

69 105 240 496
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

7708680

result:

ok single line: '7708680'

Test #30:

score: 0
Accepted
time: 64ms
memory: 4148kb

input:

69 105 240 496
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

7708680

result:

ok single line: '7708680'

Test #31:

score: 0
Accepted
time: 266ms
memory: 4416kb

input:

335 15 432 496
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...

output:

5145670350

result:

ok single line: '5145670350'

Test #32:

score: 0
Accepted
time: 266ms
memory: 4412kb

input:

335 15 432 496
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...

output:

5145670350

result:

ok single line: '5145670350'

Test #33:

score: 0
Accepted
time: 109ms
memory: 4460kb

input:

273 172 265 496
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...

output:

73054029616932

result:

ok single line: '73054029616932'

Test #34:

score: 0
Accepted
time: 110ms
memory: 4140kb

input:

172 273 265 496
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...

output:

73054029616932

result:

ok single line: '73054029616932'

Test #35:

score: 0
Accepted
time: 368ms
memory: 4732kb

input:

499 499 500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0

result:

ok single line: '0'

Test #36:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

2 1 3 3
3 6 3
7 7 3
7 3 6

output:

16

result:

ok single line: '16'

Test #37:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

1 2 3 3
82 191 71
221 234 56
255 86 200

output:

568

result:

ok single line: '568'

Test #38:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

1 2 3 3
299701602 739500542 255491000
861557234 913571517 196621718
996040164 318365281 778213934

output:

2215432886

result:

ok single line: '2215432886'

Test #39:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

7 2 3 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 6 5...

output:

42

result:

ok single line: '42'

Test #40:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 7 3 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 234...

output:

1320

result:

ok single line: '1320'

Test #41:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

2 7 3 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 3972...

output:

5089575880

result:

ok single line: '5089575880'

Test #42:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

1 14 56 3
3 6 3
7 7 3
7 3 6
6 3 5
2 2 5
4 5 6
2 3 5
6 5 5
3 5 3
3 7 4
4 2 6
2 6 7
6 2 7
5 2 4
5 6 7
7 5 6
2 6 2
2 5 5
2 3 3
5 2 4
3 5 4
7 6 5
4 2 6
3 5 2
6 3 6
5 4 3
6 5 7
3 5 5
6 6 4
7 3 5
2 7 2
2 2 4
2 3 5
2 3 4
3 6 2
3 4 7
6 6 5
3 5 3
4 7 3
4 6 5
3 4 7
4 7 7
7 7 3
4 3 3
6 7 5
6 4 6
7 5 4
7 5 5
6 ...

output:

42

result:

ok single line: '42'

Test #43:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

14 1 56 3
82 191 71
221 234 56
255 86 200
209 60 139
12 17 145
95 161 211
18 67 150
207 159 134
62 140 69
71 229 106
129 10 177
30 203 251
204 45 216
139 29 105
171 213 217
254 158 176
17 180 46
26 154 167
17 88 64
155 17 97
79 139 117
246 198 167
130 36 189
50 158 40
213 57 189
168 97 53
183 160 23...

output:

1290

result:

ok single line: '1290'

Test #44:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

1 14 56 3
299701602 739500542 255491000
861557234 913571517 196621718
996040164 318365281 778213934
811825172 213066337 530735354
18663934 38713647 556334427
351509104 617163837 822042217
42673484 237969402 573295170
805338666 608976135 511938130
219305723 534581778 249004494
257467287 894774293 397...

output:

4924341786

result:

ok single line: '4924341786'

Test #45:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

7 14 56 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 6...

output:

196

result:

ok single line: '196'

Test #46:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

7 14 56 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 2...

output:

2800

result:

ok single line: '2800'

Test #47:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

14 7 56 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 39...

output:

9675953385

result:

ok single line: '9675953385'

Test #48:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

2 38 3 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 6 ...

output:

228

result:

ok single line: '228'

Test #49:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

38 2 3 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 23...

output:

2376

result:

ok single line: '2376'

Test #50:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

38 2 3 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 397...

output:

6446080608

result:

ok single line: '6446080608'

Test #51:

score: 0
Accepted
time: 1ms
memory: 4036kb

input:

38 14 56 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 ...

output:

1064

result:

ok single line: '1064'

Test #52:

score: 0
Accepted
time: 1ms
memory: 3960kb

input:

38 14 56 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 ...

output:

5698

result:

ok single line: '5698'

Test #53:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

38 14 56 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 3...

output:

11871610580

result:

ok single line: '11871610580'

Test #54:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

1 55 56 3
3 6 3
7 7 3
7 3 6
6 3 5
2 2 5
4 5 6
2 3 5
6 5 5
3 5 3
3 7 4
4 2 6
2 6 7
6 2 7
5 2 4
5 6 7
7 5 6
2 6 2
2 5 5
2 3 3
5 2 4
3 5 4
7 6 5
4 2 6
3 5 2
6 3 6
5 4 3
6 5 7
3 5 5
6 6 4
7 3 5
2 7 2
2 2 4
2 3 5
2 3 4
3 6 2
3 4 7
6 6 5
3 5 3
4 7 3
4 6 5
3 4 7
4 7 7
7 7 3
4 3 3
6 7 5
6 4 6
7 5 4
7 5 5
6 ...

output:

110

result:

ok single line: '110'

Test #55:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

55 1 56 3
82 191 71
221 234 56
255 86 200
209 60 139
12 17 145
95 161 211
18 67 150
207 159 134
62 140 69
71 229 106
129 10 177
30 203 251
204 45 216
139 29 105
171 213 217
254 158 176
17 180 46
26 154 167
17 88 64
155 17 97
79 139 117
246 198 167
130 36 189
50 158 40
213 57 189
168 97 53
183 160 23...

output:

1440

result:

ok single line: '1440'

Test #56:

score: 0
Accepted
time: 1ms
memory: 3988kb

input:

1 55 56 3
299701602 739500542 255491000
861557234 913571517 196621718
996040164 318365281 778213934
811825172 213066337 530735354
18663934 38713647 556334427
351509104 617163837 822042217
42673484 237969402 573295170
805338666 608976135 511938130
219305723 534581778 249004494
257467287 894774293 397...

output:

4924341786

result:

ok single line: '4924341786'

Test #57:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

55 7 56 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 6...

output:

770

result:

ok single line: '770'

Test #58:

score: 0
Accepted
time: 2ms
memory: 3792kb

input:

55 7 56 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 2...

output:

4620

result:

ok single line: '4620'

Test #59:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

7 55 56 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 39...

output:

11871610580

result:

ok single line: '11871610580'

Test #60:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

38 55 56 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 ...

output:

8360

result:

ok single line: '8360'

Test #61:

score: 0
Accepted
time: 2ms
memory: 3728kb

input:

38 55 56 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 ...

output:

37620

result:

ok single line: '37620'

Test #62:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

55 38 56 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 3...

output:

11871610580

result:

ok single line: '11871610580'

Test #63:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

24 42 43 52
299701423 739500476 255490810 861557198 913571495 196621512 996040163 318365107 778213877 811825124 213066135 530735234 18663683 38713401 556334314 351508938 617163739 822042171 42673239 237969207 573295061 805338616 608976035 511938005 219305523 534581659 249004302 257467097 894774266 3...

output:

18432996624

result:

ok single line: '18432996624'

Test #64:

score: 0
Accepted
time: 28ms
memory: 4428kb

input:

2 15 345 246
151227484 789543306 512383373 318251864 963588695 758405230 201717385 605564073 629737585 473197716 754666167 142940607 454336588 840194280 960814343 436414302 179351912 695931359 638476894 355250270 806676717 706154197 941265193 495536287 900913682 966482438 745339855 504850890 3161843...

output:

10607893296

result:

ok single line: '10607893296'

Test #65:

score: 0
Accepted
time: 75ms
memory: 4528kb

input:

179 320 347 181
690843266 346074649 434479634 175199396 173022964 863853234 303401812 815876632 481855135 813531362 940426608 310255933 125033365 135780485 379051727 765227211 137232968 261180132 832378674 563175096 283372076 323701607 320753525 522122740 438141731 147591590 944649880 555526314 3848...

output:

12475997768

result:

ok single line: '12475997768'

Test #66:

score: 0
Accepted
time: 180ms
memory: 4584kb

input:

113 275 475 269
113173038 487092470 999914535 894718897 815790551 7023415 968172060 855456713 946637580 278744292 428576107 549547442 742283675 459545109 278829757 533857210 733756892 735260259 491373050 423373044 587219631 455012600 306684152 941825608 681089370 127674521 176182842 772826942 208068...

output:

18926461488

result:

ok single line: '18926461488'

Test #67:

score: 0
Accepted
time: 63ms
memory: 4316kb

input:

299 13 220 349
258493285 307845371 532315762 2398579 424173141 232074804 572538364 583330321 565177533 728358936 175872458 715806529 324837035 257332162 196043174 173473879 291633387 92762231 684793798 612712854 608296346 563274451 916889773 968987270 287875818 350964183 367231277 743415894 67735388...

output:

17317141176

result:

ok single line: '17317141176'

Test #68:

score: 0
Accepted
time: 4ms
memory: 3756kb

input:

52 140 53 205
237057534 333472068 534838424 776374312 974185803 306067083 66737009 592872142 674003338 567292415 306095916 383055142 355814607 340531269 32453991 529721604 408869340 49747524 273794260 439581850 855718267 841576925 743651609 890739119 83767242 515186997 809122934 213930005 481869778 ...

output:

12829142123

result:

ok single line: '12829142123'

Test #69:

score: 0
Accepted
time: 11ms
memory: 4140kb

input:

195 51 236 55
376574157 667328817 933261403 968917700 49822974 207476133 497468654 480689879 499301122 943285610 380945871 564780818 104115722 831972306 10024206 412028172 514957844 896639589 334503651 529334328 912727050 571672234 515693717 769722833 425218605 80754744 561648027 103665544 254764989...

output:

15023476650

result:

ok single line: '15023476650'

Test #70:

score: 0
Accepted
time: 80ms
memory: 4168kb

input:

60 152 230 413
467307541 166719534 627152214 544927009 900086702 163903661 133245152 480840734 86989022 75323603 502720804 989379452 13533193 920269489 448171389 957793795 89292749 849629532 787024336 967330655 870804773 13969146 346908728 797644884 953797462 950535284 565797758 389114933 708352134 ...

output:

17139198780

result:

ok single line: '17139198780'