QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#141590 | #2136. Exam registration | Anwar_Gehad_Maghraby# | AC ✓ | 496ms | 27308kb | C++23 | 1.3kb | 2023-08-17 17:08:58 | 2023-08-17 17:08:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
const int N = 1e6 + 4;
int n;
ll a[N] ;
ll b[N];
bool can(int x)
{
deque<pair<int ,int > > aa , bb;
for (int i = 0; i < n; ++i) {
aa.push_front({i , a[i]}) ;
bb.push_front({i , b[i]}) ;
while ( bb.back().first + x < aa.back().first )
{
bb.pop_back() ;
}
if(aa.back().first + x < bb.back().first) return 0;
while ( !bb.empty() && !aa.empty() )
{
auto p = bb.back() ;
bb.pop_back();
auto p2 = aa.back() ;
aa.pop_back() ;
int mn = min(p.second , p2.second );
p.second -= mn;
p2.second -= mn ;
if(p.second) bb.push_back(p) ;
if(p2.second) aa.push_back(p2) ;
}
}
return aa.empty() ;
}
int main() {
cin.tie(0);cin.sync_with_stdio(0);
cout.tie(0);cout.sync_with_stdio(0);
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i] ;
}
for (int i = 0; i < n; ++i) {
cin >> b[i] ;
}
int l = 0 , r = n-1 , md , ans = -1 ;
while (l <= r)
{
md=(l + r) /2 ;
if(can(md)) ans = md , r= md-1 ;
else l = md+1;
}
cout << ans ;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5588kb
input:
4 6 14 70 1 70 3 16 5
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5508kb
input:
1 2 2
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5568kb
input:
1 3 2
output:
-1
result:
ok 1 number(s): "-1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 5620kb
input:
6 60 27 27 27 27 27 75 27 27 27 27 97
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 1ms
memory: 5508kb
input:
7 1 1 1 1 1 1 1 1 3 3 0 0 0 0
output:
4
result:
ok 1 number(s): "4"
Test #6:
score: 0
Accepted
time: 1ms
memory: 5620kb
input:
10 6 4 9 8 6 7 4 3 6 7 8 7 7 11 6 4 6 4 7 9
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 1ms
memory: 5628kb
input:
91 1 1 2 1 1 2 1 1 2 1 2 1 1 2 1 1 1 1 2 2 2 1 1 2 1 1 1 1 1 1 1 2 2 2 2 2 2 1 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 2 2 2 2 1 1 1 1 2 1 2 1 2 2 1 2 1 2 2 2 2 1 1 2 2 1 1 2 2 1 2 2 1 2 1 1 2 2 1 1 2 2 4 0 0 2 3 4 2 1 2 4 4 0 1 3 2 2 2 1 3 3 2 0 2 2 2 3 3 3 2 3 1 2 2 1 3 1 1 3 1 3 2 2 3 2 1 3 1 3 2 1 2 4 1...
output:
2
result:
ok 1 number(s): "2"
Test #8:
score: 0
Accepted
time: 1ms
memory: 5592kb
input:
98 10 4 2 8 10 2 5 2 4 3 9 6 7 7 6 1 9 4 6 3 7 8 5 1 5 5 1 10 7 9 1 7 8 2 9 6 6 10 4 10 9 1 10 9 4 6 9 4 6 8 1 5 7 1 8 10 3 4 4 2 2 8 3 7 7 3 5 5 6 10 10 3 8 8 5 4 10 2 5 10 6 6 4 6 6 9 7 7 2 5 10 10 4 10 6 9 10 5 8 11 1 7 10 1 4 9 12 4 11 8 7 5 9 2 11 5 10 9 6 12 9 5 7 2 8 6 3 6 0 10 1 5 8 10 11 1 ...
output:
6
result:
ok 1 number(s): "6"
Test #9:
score: 0
Accepted
time: 2ms
memory: 5584kb
input:
990 1 1 1 1 1 1 2 1 1 2 2 2 1 1 1 1 2 1 1 2 1 2 1 2 2 2 2 2 1 1 1 1 2 2 1 2 1 2 2 2 1 1 2 1 1 2 2 2 2 1 1 1 2 2 2 2 1 1 1 1 2 1 1 2 1 2 2 2 1 2 1 2 1 1 2 1 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 1 2 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 1 1 1 2 1 2 1 2 1 2 2 2 2 2 2 2 1 1 1 1 1 2 2 1 1 2 2 2 1 ...
output:
3
result:
ok 1 number(s): "3"
Test #10:
score: 0
Accepted
time: 1ms
memory: 5532kb
input:
990 10 1 2 7 5 8 8 3 2 10 6 1 2 3 10 2 6 10 10 8 9 3 10 3 8 8 7 9 7 9 4 2 1 5 6 2 7 5 4 7 4 10 3 7 6 4 1 9 5 9 10 9 5 1 6 6 4 1 10 10 9 10 3 1 1 9 6 10 9 8 6 1 6 3 10 9 2 6 6 4 9 2 7 9 3 5 5 5 1 3 10 1 7 10 6 7 8 8 2 5 3 10 8 9 9 8 8 3 1 4 2 10 10 6 7 3 8 9 9 4 2 6 9 1 10 3 6 8 1 5 9 6 10 9 3 9 6 2 ...
output:
5
result:
ok 1 number(s): "5"
Test #11:
score: 0
Accepted
time: 4ms
memory: 7712kb
input:
9993 1 2 1 1 2 1 1 2 1 2 1 1 2 1 1 1 1 2 2 2 1 1 2 1 1 1 1 1 1 1 2 2 2 2 2 2 1 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 2 2 2 2 1 1 1 1 2 1 2 1 2 2 1 2 1 2 2 2 2 1 1 2 2 1 1 2 2 1 2 2 1 2 1 1 2 2 2 1 1 2 1 2 1 2 1 1 1 1 2 1 1 1 2 2 2 2 2 2 2 1 1 2 1 2 2 2 2 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 1 1 2 2 2 1 2...
output:
4
result:
ok 1 number(s): "4"
Test #12:
score: 0
Accepted
time: 3ms
memory: 5600kb
input:
9991 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 2 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2...
output:
-1
result:
ok 1 number(s): "-1"
Test #13:
score: 0
Accepted
time: 2ms
memory: 5596kb
input:
9993 2 6 10 6 8 5 7 1 10 3 9 3 2 9 10 3 4 5 6 5 2 9 8 2 3 1 6 3 1 1 5 7 6 10 6 9 4 9 8 1 1 1 10 8 7 2 5 10 9 5 5 6 10 8 3 2 7 4 4 7 7 4 6 8 10 3 7 2 3 5 4 8 7 1 10 3 8 9 8 6 1 9 6 4 8 6 1 10 1 10 2 9 5 5 1 3 6 9 8 5 3 4 4 8 1 7 5 8 4 5 6 5 5 8 2 6 6 10 8 1 3 3 5 4 3 3 5 1 1 9 6 7 5 10 6 1 6 1 8 9 9 ...
output:
8
result:
ok 1 number(s): "8"
Test #14:
score: 0
Accepted
time: 4ms
memory: 5660kb
input:
9998 9 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 10 1 1 1 1 1 1 3 1 1 1 1 1 1 6 1 1 1 1 1 1 5 1 1 1 1 1 1 6 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 9 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 5 1 1 1 1 1 1 10 1 1 1 1 1 1 7 1 1 1 1 1 1 6 1 1 1 1 1 1 8 1 1 1 1 1 ...
output:
9
result:
ok 1 number(s): "9"
Test #15:
score: 0
Accepted
time: 5ms
memory: 5652kb
input:
9998 76 89 64 24 90 32 5 79 29 33 88 38 5 83 42 12 84 30 19 98 30 45 15 80 60 26 58 16 6 17 12 75 63 85 42 34 16 6 64 27 21 33 13 77 63 55 74 99 41 67 78 62 80 7 95 18 63 7 48 98 39 29 57 61 91 98 35 13 45 60 9 31 31 82 100 89 8 72 23 67 85 60 16 95 92 21 9 25 48 60 16 51 62 26 60 46 18 47 26 35 76 ...
output:
47
result:
ok 1 number(s): "47"
Test #16:
score: 0
Accepted
time: 4ms
memory: 5584kb
input:
9998 61 47 47 99 47 47 75 47 47 69 47 47 50 47 47 66 47 47 55 47 47 99 47 47 76 47 47 52 47 47 69 47 47 94 47 47 74 47 47 94 47 47 49 47 47 55 47 47 92 47 47 85 47 47 65 47 47 79 47 47 85 47 47 53 47 47 47 47 47 77 47 47 72 47 47 81 47 47 67 47 47 92 47 47 87 47 47 77 47 47 49 47 47 57 47 47 81 47 4...
output:
10
result:
ok 1 number(s): "10"
Test #17:
score: 0
Accepted
time: 6ms
memory: 5584kb
input:
9996 73682 53329 524 85563 31208 1360 42660 20826 73101 7397 31092 31412 23234 31473 43721 58214 10972 21995 83872 85215 76579 59322 85357 33123 27604 62719 9749 22409 71552 46408 53459 15038 17227 67550 3862 19233 23981 77432 33697 42372 41076 53925 96395 23473 99488 11847 49309 65155 47142 55666 3...
output:
82
result:
ok 1 number(s): "82"
Test #18:
score: 0
Accepted
time: 2ms
memory: 5584kb
input:
9993 70981 26717 26717 79364 26717 26717 52667 26717 26717 38949 26717 26717 94252 26717 26717 52574 26717 26717 72116 26717 26717 37536 26717 26717 34274 26717 26717 27631 26717 26717 98791 26717 26717 54345 26717 26717 36144 26717 26717 35176 26717 26717 58585 26717 26717 28404 26717 26717 84273 2...
output:
14
result:
ok 1 number(s): "14"
Test #19:
score: 0
Accepted
time: 5ms
memory: 5668kb
input:
10000 275962004 783498540 368551 694532808 931076014 240593898 175420481 442971403 949380764 875185432 628557461 211909512 394773706 165216176 567140889 567669589 260936788 660704387 88516149 467610268 903599759 414979251 468347078 435163930 802782337 203395129 339879069 809616545 46621028 603232864...
output:
37
result:
ok 1 number(s): "37"
Test #20:
score: 0
Accepted
time: 5ms
memory: 5596kb
input:
9994 646218287 476110896 476110896 476110896 981871472 476110896 476110896 476110896 864008449 476110896 476110896 476110896 528742146 476110896 476110896 476110896 927974795 476110896 476110896 476110896 633057732 476110896 476110896 476110896 779042226 476110896 476110896 476110896 995834373 47611...
output:
-1
result:
ok 1 number(s): "-1"
Test #21:
score: 0
Accepted
time: 36ms
memory: 6516kb
input:
99996 1 1 1 1 1 2 1 1 2 2 2 1 1 1 1 2 1 1 2 1 2 1 2 2 2 2 2 1 1 1 1 2 2 1 2 1 2 2 2 1 1 2 1 1 2 2 2 2 1 1 1 2 2 2 2 1 1 1 1 2 1 1 2 1 2 2 2 1 2 1 2 1 1 2 1 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 1 2 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 1 1 1 2 1 2 1 2 1 2 2 2 2 2 2 2 1 1 1 1 1 2 2 1 1 2 2 2 1 ...
output:
6
result:
ok 1 number(s): "6"
Test #22:
score: 0
Accepted
time: 21ms
memory: 6416kb
input:
99990 2 1 2 1 2 1 1 1 2 1 2 1 1 1 1 1 1 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 2 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 ...
output:
-1
result:
ok 1 number(s): "-1"
Test #23:
score: 0
Accepted
time: 37ms
memory: 8424kb
input:
99998 1 4 2 5 4 2 7 5 7 9 10 6 4 3 10 2 10 2 8 9 7 8 9 3 9 8 9 9 7 10 10 3 9 1 6 6 8 8 5 6 9 8 10 9 1 4 8 6 4 6 6 10 9 10 5 4 1 10 2 10 10 5 3 2 9 3 1 3 1 10 6 6 7 10 4 2 8 1 2 9 5 9 9 1 10 2 9 1 6 6 5 2 10 6 9 1 9 5 2 7 9 10 1 2 8 9 10 6 2 2 5 10 10 3 5 9 5 3 7 2 8 6 5 2 7 3 9 4 5 6 7 3 1 6 1 5 5 7...
output:
11
result:
ok 1 number(s): "11"
Test #24:
score: 0
Accepted
time: 36ms
memory: 6388kb
input:
99998 9 5 10 5 9 5 8 5 10 5 10 5 10 5 9 5 6 5 8 5 7 5 8 5 10 5 9 5 5 5 10 5 6 5 7 5 10 5 5 5 6 5 9 5 7 5 5 5 8 5 10 5 8 5 8 5 5 5 9 5 5 5 6 5 5 5 5 5 10 5 7 5 6 5 8 5 9 5 6 5 7 5 10 5 7 5 9 5 10 5 9 5 9 5 7 5 9 5 8 5 5 5 10 5 6 5 5 5 10 5 8 5 5 5 5 5 7 5 7 5 10 5 9 5 6 5 7 5 5 5 6 5 10 5 6 5 9 5 10 ...
output:
-1
result:
ok 1 number(s): "-1"
Test #25:
score: 0
Accepted
time: 28ms
memory: 6356kb
input:
99998 9 1 11 15 10 73 28 65 1 51 28 61 51 87 81 46 47 38 4 47 57 7 28 5 63 25 28 81 60 78 77 78 27 6 49 95 57 66 57 100 93 26 85 32 97 11 15 94 79 22 75 45 18 23 1 22 45 51 13 97 88 43 79 8 59 54 33 67 8 6 8 82 69 95 75 59 32 27 81 49 13 77 43 18 72 79 76 65 92 92 64 49 29 94 82 65 23 21 50 61 77 14...
output:
96
result:
ok 1 number(s): "96"
Test #26:
score: 0
Accepted
time: 37ms
memory: 8504kb
input:
99991 93 34 34 100 34 34 58 34 34 58 34 34 57 34 34 80 34 34 51 34 34 56 34 34 74 34 34 65 34 34 67 34 34 38 34 34 46 34 34 87 34 34 57 34 34 89 34 34 65 34 34 78 34 34 92 34 34 77 34 34 68 34 34 55 34 34 96 34 34 91 34 34 100 34 34 88 34 34 64 34 34 83 34 34 52 34 34 43 34 34 61 34 34 36 34 34 81 3...
output:
-1
result:
ok 1 number(s): "-1"
Test #27:
score: 0
Accepted
time: 49ms
memory: 8400kb
input:
99996 42651 99480 61874 61382 66259 96270 12026 4551 84222 4942 43634 37128 68846 90022 69006 71403 23034 87370 54311 87892 44060 26898 42135 69550 18161 53975 87648 57156 52157 98361 10662 32137 82053 3323 73264 76273 32498 94757 1547 64565 2805 68354 52999 34707 94461 10144 82104 37388 18402 67154...
output:
192
result:
ok 1 number(s): "192"
Test #28:
score: 0
Accepted
time: 33ms
memory: 10088kb
input:
99992 81426 32482 32482 32482 32482 32482 39747 32482 32482 32482 32482 32482 90540 32482 32482 32482 32482 32482 96986 32482 32482 32482 32482 32482 68646 32482 32482 32482 32482 32482 64867 32482 32482 32482 32482 32482 76833 32482 32482 32482 32482 32482 67999 32482 32482 32482 32482 32482 97327 ...
output:
-1
result:
ok 1 number(s): "-1"
Test #29:
score: 0
Accepted
time: 46ms
memory: 9844kb
input:
99998 150331866 363333143 377779411 860603526 913504165 924310328 66464306 770236244 504650202 682266956 895278881 447611165 157998991 736194773 215252951 563034965 645374523 974439768 443683630 387002035 716189242 735082974 967929123 266955186 83260237 180254068 69292378 527668497 473654039 2528741...
output:
210
result:
ok 1 number(s): "210"
Test #30:
score: 0
Accepted
time: 40ms
memory: 10164kb
input:
99999 330023208 168764840 782458639 168764840 660524242 168764840 456262054 168764840 331506805 168764840 998740121 168764840 526044198 168764840 324700202 168764840 428639034 168764840 619832456 168764840 277996605 168764840 576334208 168764840 861910739 168764840 372038825 168764840 749820126 1687...
output:
-1
result:
ok 1 number(s): "-1"
Test #31:
score: 0
Accepted
time: 357ms
memory: 20888kb
input:
999990 2 1 1 2 1 1 2 1 2 1 1 2 1 1 1 1 2 2 2 1 1 2 1 1 1 1 1 1 1 2 2 2 2 2 2 1 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 2 2 2 2 1 1 1 1 2 1 2 1 2 2 1 2 1 2 2 2 2 1 1 2 2 1 1 2 2 1 2 2 1 2 1 1 2 2 2 1 1 2 1 2 1 2 1 1 1 1 2 1 1 1 2 2 2 2 2 2 2 1 1 2 1 2 2 2 2 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 1 1 2 2 2 1 2...
output:
6
result:
ok 1 number(s): "6"
Test #32:
score: 0
Accepted
time: 228ms
memory: 19576kb
input:
999990 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 2 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1...
output:
-1
result:
ok 1 number(s): "-1"
Test #33:
score: 0
Accepted
time: 458ms
memory: 19584kb
input:
999995 4 6 7 4 1 2 2 7 10 9 4 3 10 2 1 7 9 5 3 10 1 10 6 4 7 7 9 3 1 1 10 10 4 7 1 9 6 4 5 5 2 3 8 4 3 2 3 3 7 8 4 4 7 9 1 3 9 8 10 6 5 8 9 3 8 3 3 3 8 4 3 7 5 10 9 2 5 3 6 5 8 7 1 8 4 10 6 10 7 6 9 6 6 10 7 9 10 6 2 3 10 9 6 9 9 4 7 3 7 2 7 7 2 8 8 7 6 3 6 3 3 6 4 1 6 4 4 5 9 1 2 4 10 6 8 5 8 9 3 4...
output:
16
result:
ok 1 number(s): "16"
Test #34:
score: 0
Accepted
time: 387ms
memory: 21240kb
input:
999991 8 2 5 2 6 2 4 2 9 2 6 2 8 2 6 2 9 2 9 2 6 2 2 2 9 2 5 2 6 2 7 2 3 2 7 2 4 2 8 2 10 2 7 2 4 2 10 2 6 2 5 2 3 2 6 2 10 2 7 2 3 2 3 2 3 2 5 2 7 2 6 2 5 2 4 2 4 2 5 2 10 2 8 2 10 2 5 2 3 2 10 2 10 2 3 2 8 2 9 2 9 2 2 2 8 2 6 2 6 2 8 2 2 2 6 2 7 2 5 2 2 2 3 2 5 2 2 2 10 2 3 2 10 2 10 2 7 2 4 2 4 2...
output:
-1
result:
ok 1 number(s): "-1"
Test #35:
score: 0
Accepted
time: 433ms
memory: 19204kb
input:
999992 5 79 58 65 21 28 42 23 30 80 69 95 67 11 34 39 36 100 76 89 34 87 95 92 86 74 92 80 6 83 25 93 14 32 27 5 9 83 82 49 85 54 9 33 35 84 3 89 13 82 59 84 38 39 13 13 41 65 22 33 42 74 72 90 51 27 80 75 24 32 75 22 45 86 73 56 43 28 9 53 2 90 50 41 9 77 59 80 100 5 93 75 30 22 84 21 49 92 78 31 1...
output:
104
result:
ok 1 number(s): "104"
Test #36:
score: 0
Accepted
time: 387ms
memory: 20740kb
input:
999997 6 2 2 2 63 2 2 2 40 2 2 2 8 2 2 2 100 2 2 2 28 2 2 2 8 2 2 2 90 2 2 2 91 2 2 2 20 2 2 2 29 2 2 2 69 2 2 2 54 2 2 2 32 2 2 2 33 2 2 2 30 2 2 2 67 2 2 2 32 2 2 2 6 2 2 2 76 2 2 2 58 2 2 2 3 2 2 2 36 2 2 2 88 2 2 2 63 2 2 2 71 2 2 2 99 2 2 2 48 2 2 2 92 2 2 2 93 2 2 2 36 2 2 2 63 2 2 2 79 2 2 2 ...
output:
25
result:
ok 1 number(s): "25"
Test #37:
score: 0
Accepted
time: 430ms
memory: 19152kb
input:
999996 11198 95971 61303 98820 75583 31956 60086 5482 94758 97861 48180 327 62585 38660 30962 77110 54419 64820 42337 11458 11873 64714 88843 78348 31427 77139 34602 61417 64017 63276 14927 60449 56467 86088 11612 43825 89288 21134 16618 84554 576 96409 132 74064 18402 80726 78538 16731 24199 1929 6...
output:
1173
result:
ok 1 number(s): "1173"
Test #38:
score: 0
Accepted
time: 419ms
memory: 19304kb
input:
999997 83658 47311 47311 47311 47311 47311 49911 47311 47311 47311 47311 47311 99202 47311 47311 47311 47311 47311 70479 47311 47311 47311 47311 47311 79731 47311 47311 47311 47311 47311 95066 47311 47311 47311 47311 47311 88201 47311 47311 47311 47311 47311 97221 47311 47311 47311 47311 47311 57403...
output:
5
result:
ok 1 number(s): "5"
Test #39:
score: 0
Accepted
time: 496ms
memory: 19104kb
input:
999992 828655486 762179092 100421438 325263405 593193440 514202746 227842137 947929163 374997852 501830156 30905324 313792507 446393650 803167777 990184336 231212414 920627957 713506438 241251443 163739852 660368654 797524477 759250901 322245647 20274487 806901433 628004238 148133413 21249792 482178...
output:
959
result:
ok 1 number(s): "959"
Test #40:
score: 0
Accepted
time: 377ms
memory: 20304kb
input:
999999 784419391 285223791 285223791 285223791 285223791 285223791 285223791 528668133 285223791 285223791 285223791 285223791 285223791 285223791 620276579 285223791 285223791 285223791 285223791 285223791 285223791 935864433 285223791 285223791 285223791 285223791 285223791 285223791 553880041 285...
output:
3
result:
ok 1 number(s): "3"
Test #41:
score: 0
Accepted
time: 1ms
memory: 5452kb
input:
8 1 2 3 4 5 6 7 8 8 8 7 6 4 4 2 2
output:
3
result:
ok 1 number(s): "3"
Test #42:
score: 0
Accepted
time: 0ms
memory: 5540kb
input:
8 8 7 6 5 4 3 2 1 2 3 4 5 5 6 7 8
output:
3
result:
ok 1 number(s): "3"
Test #43:
score: 0
Accepted
time: 0ms
memory: 5628kb
input:
8 2 1 1 1 10 6 4 7 8 3 10 10 9 4 0 0
output:
3
result:
ok 1 number(s): "3"
Test #44:
score: 0
Accepted
time: 1ms
memory: 5508kb
input:
9 12 4 3 7 6 1 5 4 1 0 8 4 5 7 4 13 6 13
output:
2
result:
ok 1 number(s): "2"
Test #45:
score: 0
Accepted
time: 2ms
memory: 5512kb
input:
90 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 90 89 89 87 87 86 84 83 82 82 81 80 ...
output:
37
result:
ok 1 number(s): "37"
Test #46:
score: 0
Accepted
time: 0ms
memory: 5508kb
input:
94 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 3 4 5 6 7 8 8 10 10 11...
output:
39
result:
ok 1 number(s): "39"
Test #47:
score: 0
Accepted
time: 1ms
memory: 5548kb
input:
92 1 1 6 1 1 8 5 3 11 13 16 15 16 9 18 16 19 15 17 18 26 23 23 22 28 30 27 32 33 26 35 30 31 33 35 38 33 35 43 42 37 39 40 44 49 46 51 52 53 47 55 53 51 56 60 52 61 57 59 55 60 63 59 66 65 65 64 69 65 68 66 68 75 78 80 79 77 82 74 76 77 82 82 83 86 90 88 85 94 86 93 88 89 91 91 84 84 85 84 84 80 84 ...
output:
38
result:
ok 1 number(s): "38"
Test #48:
score: 0
Accepted
time: 1ms
memory: 5628kb
input:
96 94 93 97 91 96 89 94 84 91 92 91 87 89 83 86 83 75 82 78 81 76 76 72 75 73 74 66 73 69 67 66 66 63 62 61 62 59 63 57 52 51 54 52 54 53 55 51 46 44 44 46 50 40 41 39 41 43 36 41 35 34 36 38 28 32 30 35 34 27 30 25 23 22 22 23 20 24 14 19 13 14 19 11 9 8 14 5 8 8 6 9 10 8 1 2 5 2 3 0 9 4 2 12 13 14...
output:
40
result:
ok 1 number(s): "40"
Test #49:
score: 0
Accepted
time: 2ms
memory: 5536kb
input:
995 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
output:
412
result:
ok 1 number(s): "412"
Test #50:
score: 0
Accepted
time: 2ms
memory: 5600kb
input:
998 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 ...
output:
413
result:
ok 1 number(s): "413"
Test #51:
score: 0
Accepted
time: 2ms
memory: 5588kb
input:
995 1 1 5 1 9 2 8 7 12 8 10 8 9 14 17 19 14 19 24 18 23 19 23 28 22 25 26 27 25 30 33 37 31 30 32 39 42 43 41 44 42 38 42 44 49 42 51 52 49 45 52 52 57 55 56 56 55 57 64 63 63 66 67 63 65 61 71 69 67 75 72 67 74 72 79 75 80 83 76 76 78 83 88 88 90 85 84 84 93 94 88 92 88 95 93 92 95 96 103 98 101 97...
output:
412
result:
ok 1 number(s): "412"
Test #52:
score: 0
Accepted
time: 2ms
memory: 5584kb
input:
1000 1000 997 1000 994 992 993 998 998 996 986 990 989 990 985 983 990 981 981 982 977 977 983 976 981 981 974 971 976 976 970 971 964 970 963 967 970 960 967 963 961 957 959 958 956 955 957 956 949 953 954 949 948 947 949 946 947 946 944 946 941 939 943 939 938 936 930 933 930 930 926 930 928 928 9...
output:
414
result:
ok 1 number(s): "414"
Test #53:
score: 0
Accepted
time: 5ms
memory: 7652kb
input:
9998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
4141
result:
ok 1 number(s): "4141"
Test #54:
score: 0
Accepted
time: 4ms
memory: 5696kb
input:
9999 9999 9998 9997 9996 9995 9994 9993 9992 9991 9990 9989 9988 9987 9986 9985 9984 9983 9982 9981 9980 9979 9978 9977 9976 9975 9974 9973 9972 9971 9970 9969 9968 9967 9966 9965 9964 9963 9962 9961 9960 9959 9958 9957 9956 9955 9954 9953 9952 9951 9950 9949 9948 9947 9946 9945 9944 9943 9942 9941 ...
output:
4141
result:
ok 1 number(s): "4141"
Test #55:
score: 0
Accepted
time: 5ms
memory: 5688kb
input:
9993 3 7 1 2 10 11 10 4 12 12 15 12 12 12 14 16 17 18 16 23 16 20 19 19 21 26 22 28 29 28 27 35 33 29 30 33 39 36 41 42 42 42 47 47 46 45 49 44 52 52 50 56 57 53 58 57 60 61 62 57 61 61 66 68 65 65 72 68 70 73 73 68 68 74 70 75 81 80 78 75 86 85 85 83 89 88 91 84 91 89 89 92 89 89 90 92 93 103 101 1...
output:
4139
result:
ok 1 number(s): "4139"
Test #56:
score: 0
Accepted
time: 0ms
memory: 5748kb
input:
9995 9993 9999 9998 9989 9988 9993 9993 9992 9989 9984 9985 9979 9988 9984 9982 9981 9982 9980 9980 9980 9974 9977 9974 9968 9974 9968 9974 9964 9972 9971 9964 9960 9967 9967 9958 9956 9957 9958 9960 9953 9951 9959 9958 9952 9949 9947 9944 9947 9950 9949 9941 9939 9946 9944 9941 9939 9944 9936 9940 ...
output:
4140
result:
ok 1 number(s): "4140"
Test #57:
score: 0
Accepted
time: 37ms
memory: 6708kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
41421
result:
ok 1 number(s): "41421"
Test #58:
score: 0
Accepted
time: 30ms
memory: 8684kb
input:
99995 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952 99951 99950 99949 99948 99947 ...
output:
41419
result:
ok 1 number(s): "41419"
Test #59:
score: 0
Accepted
time: 33ms
memory: 8788kb
input:
99996 1 1 1 1 1 6 11 5 4 9 10 8 14 11 10 18 21 21 24 15 17 27 25 24 20 25 25 26 27 33 34 28 34 37 30 40 32 37 39 36 41 37 47 47 50 46 52 52 46 53 50 55 48 56 51 51 60 58 54 59 60 58 63 64 68 65 72 73 74 71 72 75 73 78 76 78 76 81 78 76 84 84 82 87 89 84 90 84 87 91 86 93 88 93 97 92 99 99 99 97 96 9...
output:
41419
result:
ok 1 number(s): "41419"
Test #60:
score: 0
Accepted
time: 36ms
memory: 8696kb
input:
99997 99995 100001 100000 99996 99990 99992 99986 99988 99992 99991 99988 99985 99980 99982 99987 99984 99982 99979 99978 99976 99979 99979 99975 99975 99969 99969 99973 99969 99966 99964 99963 99961 99969 99967 99960 99962 99959 99959 99962 99956 99961 99952 99951 99953 99952 99953 99948 99947 9994...
output:
41420
result:
ok 1 number(s): "41420"
Test #61:
score: 0
Accepted
time: 459ms
memory: 22364kb
input:
999997 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
414212
result:
ok 1 number(s): "414212"
Test #62:
score: 0
Accepted
time: 382ms
memory: 22568kb
input:
999997 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 999959 999958 999957 999956...
output:
414212
result:
ok 1 number(s): "414212"
Test #63:
score: 0
Accepted
time: 477ms
memory: 22304kb
input:
999999 6 4 1 1 9 1 5 6 11 7 16 11 15 19 10 11 20 13 20 23 24 27 25 27 20 28 32 30 25 30 30 37 28 31 40 39 36 42 34 36 46 45 39 44 42 50 49 44 53 48 54 55 52 58 52 55 53 56 63 55 66 57 60 64 69 69 64 64 72 72 73 68 72 76 73 80 82 77 80 84 79 81 88 86 87 87 85 89 93 92 86 90 92 91 97 101 102 101 98 10...
output:
414213
result:
ok 1 number(s): "414213"
Test #64:
score: 0
Accepted
time: 370ms
memory: 22584kb
input:
999992 999990 999995 999987 999992 999990 999990 999984 999982 999982 999983 999978 999986 999983 999975 999978 999978 999981 999977 999977 999976 999977 999970 999970 999968 999970 999968 999964 999964 999962 999966 999959 999958 999959 999955 999959 999953 999958 999952 999958 999955 999947 999949...
output:
414210
result:
ok 1 number(s): "414210"
Test #65:
score: 0
Accepted
time: 174ms
memory: 19080kb
input:
999995 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
0
result:
ok 1 number(s): "0"
Test #66:
score: 0
Accepted
time: 249ms
memory: 19220kb
input:
999990 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 3 1 1 1 1 1 3 1 1 1 1 1 2 1 1 1 1 1 4 1 1 1 1 1 3 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 4 1 1 1 1 1 3 1 1 1 1 1 4 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 3 1 1 1 1 1 3 1 1 1 1 1 4 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 3 1 1...
output:
18
result:
ok 1 number(s): "18"
Test #67:
score: 0
Accepted
time: 338ms
memory: 22892kb
input:
999996 3 1 6 1 9 1 2 1 1 1 3 1 2 1 7 1 8 1 8 1 2 1 8 1 7 1 1 1 1 1 5 1 3 1 9 1 9 1 7 1 9 1 8 1 2 1 6 1 9 1 5 1 8 1 1 1 3 1 4 1 9 1 3 1 9 1 2 1 3 1 8 1 4 1 7 1 5 1 6 1 9 1 5 1 8 1 8 1 3 1 3 1 6 1 5 1 8 1 5 1 8 1 9 1 2 1 2 1 1 1 3 1 8 1 7 1 1 1 7 1 2 1 2 1 4 1 9 1 4 1 8 1 9 1 2 1 9 1 2 1 6 1 9 1 3 1 6...
output:
-1
result:
ok 1 number(s): "-1"
Test #68:
score: 0
Accepted
time: 399ms
memory: 19196kb
input:
999999 3 999999996 2 999999990 3 999999994 5 999999990 3 999999992 2 999999992 1 999999991 4 999999996 2 999999995 5 999999991 5 999999997 1 999999994 5 999999998 1 999999996 5 999999996 4 999999989 3 999999996 4 999999994 5 999999999 4 999999991 4 999999990 3 999999992 2 999999993 4 999999997 5 999...
output:
2
result:
ok 1 number(s): "2"
Test #69:
score: 0
Accepted
time: 400ms
memory: 19100kb
input:
1000000 3 999999997 1 999999998 5 1000000000 1 999999997 5 999999999 3 999999993 1 999999992 5 999999999 3 999999997 1 999999990 4 999999990 5 999999996 2 999999990 3 1000000000 1 999999991 5 999999993 2 999999995 4 999999997 4 999999992 4 999999991 2 999999998 3 999999995 3 999999996 1 999999999 4 ...
output:
2
result:
ok 1 number(s): "2"
Test #70:
score: 0
Accepted
time: 466ms
memory: 27300kb
input:
999997 999999990 2 5 2 2 1 3 3 2 5 2 2 3 5 3 3 5 1 2 3 1 3 5 5 1 3 4 4 5 1 4 3 2 2 1 1 4 1 2 4 4 1 5 5 5 4 1 2 1 2 5 3 3 4 3 4 2 5 1 3 2 4 4 3 3 3 3 4 2 1 2 5 3 2 2 3 4 3 3 4 4 1 4 1 3 2 3 2 2 4 2 4 3 5 5 4 5 2 3 4 1 2 4 4 3 5 5 3 3 2 5 4 1 1 2 4 5 2 2 2 4 3 3 4 5 5 4 5 5 5 4 2 4 2 3 4 4 3 4 2 3 5 1...
output:
999996
result:
ok 1 number(s): "999996"
Test #71:
score: 0
Accepted
time: 493ms
memory: 27308kb
input:
999995 999999995 999999992 999999995 999999992 1000000000 999999998 999999991 1 5 3 4 5 2 3 1 3 4 5 4 2 5 1 5 4 2 4 4 2 1 2 3 3 4 4 2 4 2 3 2 2 2 2 2 2 2 5 1 3 1 5 2 3 3 2 5 4 4 1 3 2 5 2 1 5 5 4 3 4 2 5 2 5 3 1 2 2 5 5 4 3 5 4 4 2 4 2 5 4 4 3 1 1 3 2 4 5 2 4 5 3 5 2 5 1 1 1 2 1 3 2 5 1 3 1 3 2 5 1 ...
output:
999988
result:
ok 1 number(s): "999988"