QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#645111 | #7611. Max-Min | ucup-team4479# | AC ✓ | 629ms | 30588kb | C++23 | 4.8kb | 2024-10-16 16:55:54 | 2024-10-16 16:55:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int N=500005;
int n,q;
int a[N];
struct Segment_Tree
{
#define ls i*2
#define rs i*2+1
struct Node
{
int l,r;
int mn,mx;
}tree[N*4];
void push_up(int i)
{
tree[i].mn=min(tree[ls].mn,tree[rs].mn);
tree[i].mx=max(tree[ls].mx,tree[rs].mx);
return;
}
void build(int i,int l,int r)
{
tree[i].l=l,tree[i].r=r;
if(l==r)
{
tree[i].mx=tree[i].mn=a[l];
return;
}
int mid=(l+r)>>1;
build(ls,l,mid);
build(rs,mid+1,r);
push_up(i);
return;
}
void add(int i,int u,int v)
{
if(tree[i].l==tree[i].r)
{
tree[i].mx+=v;
tree[i].mn+=v;
return;
}
if(u<=tree[ls].r) add(ls,u,v);
else add(rs,u,v);
push_up(i);
return;
}
int query_prefix_less(int i,int u,int x)
{
if(u<1) return 0;
if(tree[i].mn>x) return tree[i].l-1;
if(tree[i].l==tree[i].r) return tree[i].l;
if(u<=tree[ls].r) return query_prefix_less(ls,u,x);
if(tree[rs].mn>x) return query_prefix_less(ls,u,x);
int p=query_prefix_less(rs,u,x);
if(p!=tree[rs].l-1) return p;
return query_prefix_less(ls,u,x);
}
int query_suffix_less(int i,int u,int x)
{
if(u>n) return n+1;
if(tree[i].mn>x) return tree[i].r+1;
if(tree[i].l==tree[i].r) return tree[i].r;
if(u>=tree[rs].l) return query_suffix_less(rs,u,x);
if(tree[ls].mn>x) return query_suffix_less(rs,u,x);
int p=query_suffix_less(ls,u,x);
if(p!=tree[ls].r+1) return p;
return query_suffix_less(rs,u,x);
}
int query_prefix_greater(int i,int u,int x)
{
if(u<1) return 0;
if(tree[i].mx<x) return tree[i].l-1;
if(tree[i].l==tree[i].r) return tree[i].l;
if(u<=tree[ls].r) return query_prefix_greater(ls,u,x);
if(tree[rs].mx<x) return query_prefix_greater(ls,u,x);
int p=query_prefix_greater(rs,u,x);
if(p!=tree[rs].l-1) return p;
return query_prefix_greater(ls,u,x);
}
int query_suffix_greater(int i,int u,int x)
{
if(u>n) return n+1;
if(tree[i].mx<x) return tree[i].r+1;
if(tree[i].l==tree[i].r) return tree[i].r;
if(u>=tree[rs].l) return query_suffix_greater(rs,u,x);
if(tree[ls].mx<x) return query_suffix_greater(rs,u,x);
int p=query_suffix_greater(ls,u,x);
if(p!=tree[ls].r+1) return p;
return query_suffix_greater(rs,u,x);
}
#undef ls
#undef rs
}T;
int pre[N],suf[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
cin>>n>>q;
for(int i=1;i<=n;i++)
cin>>a[i];
stack<int>s;
for(int i=1;i<=n;i++)
{
while(!s.empty()&&a[s.top()]<a[i]) s.pop();
if(s.empty()) pre[i]=0;
else pre[i]=s.top();
s.emplace(i);
}
while(!s.empty())
s.pop();
for(int i=n;i>=1;i--)
{
while(!s.empty()&&a[s.top()]<=a[i]) s.pop();
if(s.empty()) suf[i]=n+1;
else suf[i]=s.top();
s.emplace(i);
}
long long mx=0;
for(int i=1;i<=n;i++)
mx+=(long long)(i-pre[i])*(suf[i]-i)*a[i];
while(!s.empty())
s.pop();
for(int i=1;i<=n;i++)
{
while(!s.empty()&&a[s.top()]>a[i]) s.pop();
if(s.empty()) pre[i]=0;
else pre[i]=s.top();
s.emplace(i);
}
while(!s.empty())
s.pop();
for(int i=n;i>=1;i--)
{
while(!s.empty()&&a[s.top()]>=a[i]) s.pop();
if(s.empty()) suf[i]=n+1;
else suf[i]=s.top();
s.emplace(i);
}
long long mn=0;
for(int i=1;i<=n;i++)
mn+=(long long)(i-pre[i])*(suf[i]-i)*a[i];
T.build(1,1,n);
while(q--)
{
char op;
int p;
cin>>op>>p;
if(op=='-')
{
int ll=T.query_prefix_greater(1,p-1,a[p]),rr=T.query_suffix_greater(1,p+1,a[p]);
mx-=(long long)(p-ll)*(rr-p);
ll=T.query_prefix_less(1,p-1,a[p]-1),rr=T.query_suffix_less(1,p+1,a[p]-1);
mn-=(long long)(p-ll)*(rr-p);
a[p]--;
T.add(1,p,-1);
}
else if(op=='+')
{
int ll=T.query_prefix_greater(1,p-1,a[p]+1),rr=T.query_suffix_greater(1,p+1,a[p]+1);
mx+=(long long)(p-ll)*(rr-p);
ll=T.query_prefix_less(1,p-1,a[p]),rr=T.query_suffix_less(1,p+1,a[p]);
mn+=(long long)(p-ll)*(rr-p);
a[p]++;
T.add(1,p,1);
}
long long ans=mx-mn;
cout<<ans<<"\n";
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 7972kb
input:
3 6 0 0 -1 + 3 + 3 - 2 - 2 + 2 + 1
output:
0 2 5 8 5 6
result:
ok 6 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 9720kb
input:
1 1 0 + 1
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 229ms
memory: 9832kb
input:
1025 500000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -10...
output:
104959999997 104960179065 104960179062 104960199263 104960199266 104960293315 104960472383 104960378334 104960526073 104960517442 104960526681 104960705749 104960798348 104960619280 104960619277 104960619274 104960619271 104960619274 104960440206 104960652725 104960652722 104960652725 104960652722 1...
result:
ok 500000 lines
Test #4:
score: 0
Accepted
time: 557ms
memory: 28460kb
input:
500000 500000 54181 46637 -2621 18334 55372 -53002 82186 -1463 93261 63053 -79663 98576 -95766 91470 58638 31500 85909 76726 -20694 -5761 48617 34968 4886 55627 -42510 45591 89565 -79895 65387 -64403 -77506 97343 94193 46041 -85383 2673 74798 -54541 43604 -29672 72296 -28317 8037 -65719 -54207 53468...
output:
24998004876352508 24998004876352519 24998004876352517 24998004876356492 24998004876355181 24998004876355182 24998004876355205 24998004876355205 24998004876355210 24998004876355157 24998004876355142 24998004876355146 24998004876353597 24998004876353606 24998004876354550 24998004876354548 249980048763...
result:
ok 500000 lines
Test #5:
score: 0
Accepted
time: 629ms
memory: 28700kb
input:
500000 500000 -1 -2 1 1 0 -3 0 3 1 0 -2 -1 1 -2 1 3 0 -3 -3 -2 -1 -3 1 -2 -3 0 2 0 -1 0 -2 -1 2 0 -3 2 -1 -3 -2 2 -2 -1 -1 -1 1 -3 0 0 -3 3 -3 0 0 -3 1 0 3 -2 1 1 0 2 1 1 -2 2 -2 -3 1 1 0 -2 -3 -3 0 1 -1 -1 1 1 1 -3 2 -2 3 1 2 3 3 0 -1 -1 -2 1 2 1 -2 -2 3 1 3 2 -1 2 -3 -1 -2 -2 2 -2 3 -1 3 3 3 -3 1 ...
output:
749990346961 749990346971 749990346988 749990346992 749990346993 749990346993 809605564336 871925650829 881066164939 881066164942 881066164934 881066164934 881066164969 881066164972 881066164973 887216105984 887216105969 887216105974 900693012690 902436118847 902436118827 902436118818 902436118929 9...
result:
ok 500000 lines
Test #6:
score: 0
Accepted
time: 575ms
memory: 29436kb
input:
500000 500000 50000 50000 49999 49998 49998 49997 49997 49997 49996 49995 49995 49995 49992 49992 49991 49990 49990 49990 49989 49989 49989 49988 49987 49987 49986 49986 49986 49986 49985 49985 49985 49984 49984 49984 49984 49983 49983 49983 49982 49982 49982 49981 49980 49979 49979 49979 49979 4997...
output:
6251153789925450 6251153789763576 6251153789541527 6251153790454170 6251153790900554 6251153790827024 6251153790727306 6251153791965831 6251153793320525 6251153794182062 6251153794344648 6251153795092139 6251153794954252 6251153795716866 6251153795803477 6251153796125622 6251153796351459 62511537964...
result:
ok 500000 lines
Test #7:
score: 0
Accepted
time: 579ms
memory: 29100kb
input:
500000 500000 50001 50000 49998 49999 49997 49998 49997 49997 49995 49995 49996 49996 49996 49995 49995 49994 49993 49994 49994 49994 49993 49993 49991 49993 49989 49990 49989 49988 49987 49988 49986 49985 49985 49987 49985 49985 49981 49982 49982 49982 49983 49981 49980 49980 49980 49980 49979 4997...
output:
6253323343133900 6253323343563847 6253323343418702 6253323342998034 6253323342998030 6253323342998051 6253323342998048 6253323342998049 6253323342885308 6253323341644059 6253323341418715 6253323341658184 6253323344075703 6253323342343989 6253323342369475 6253323341943180 6253323341780542 62533233416...
result:
ok 500000 lines
Test #8:
score: 0
Accepted
time: 574ms
memory: 26416kb
input:
500000 500000 -5700 -5699 -5700 -5700 -5698 -5699 -5698 -5699 -5700 -5699 -5701 -5700 -5700 -5697 -5699 -5699 -5700 -5699 -5699 -5700 -5698 -5700 -5700 -5700 -5700 -5695 -5699 -5700 -5697 -5699 -5700 -5697 -5699 -5700 -5700 -5699 -5699 -5699 -5699 -5698 -5698 -5698 -5701 -5699 -5699 -5698 -5695 -569...
output:
713179809156264 713179809156215 713179809156210 713179809156208 713179809156193 713179809156196 713179809156143 713179809156146 713179809108795 713179809065887 713179807453886 713179807453863 713179807453865 713179807453862 713179807453941 713179807453941 713179807453928 713179807453923 713179807453...
result:
ok 500000 lines
Test #9:
score: 0
Accepted
time: 222ms
memory: 28884kb
input:
500000 500000 5 3 -1 3 -2 -2 4 3 -5 3 5 -4 0 5 2 3 3 -4 4 -4 3 -3 2 -3 -4 -3 3 -1 -4 1 -4 -5 4 -3 2 1 5 -3 4 0 3 -5 2 2 3 -3 0 0 5 0 4 -4 5 3 -3 4 0 -4 -3 3 3 0 -3 1 -3 3 -5 4 5 -3 4 4 -4 1 1 5 1 -3 5 5 -3 2 -2 1 -5 -2 5 5 1 -3 2 -5 -4 -2 0 5 -3 2 -2 -1 -1 -3 1 5 -1 5 3 5 -1 -1 -3 2 4 -1 1 -3 -3 -3 ...
output:
1249980351918 1249980351663 1249980351615 1249980351588 1249980351589 1249980351478 1310085722571 1310085722532 1310085722515 1310085722507 1310085722546 1310085722547 1310085722658 1310085722571 1370191974458 1370191974447 1370191974420 1370195262616 1370195261697 1370195261432 1310089009545 131008...
result:
ok 500000 lines
Test #10:
score: 0
Accepted
time: 231ms
memory: 28704kb
input:
500000 500000 -9 197 -106 -353 178 722 180 341 729 -714 781 -314 -92 -706 479 -686 -744 626 182 -851 -121 -927 349 -532 346 509 288 -991 788 516 773 532 -576 178 857 -501 404 537 858 676 -410 887 23 -764 -729 -371 -886 -599 127 134 -259 59 77 -293 -46 -733 605 279 -829 -59 -147 180 -504 -484 113 -82...
output:
250046403667257 250046403454956 250046400838453 250046388481310 250079118507169 250099029784939 250104429790746 250108486422971 250111235091744 250111234969434 250171086933451 250171086163036 250171080534967 250167023902742 250167024025052 250211137697815 250220875267276 250280727231293 250220875267...
result:
ok 500000 lines
Test #11:
score: 0
Accepted
time: 245ms
memory: 26660kb
input:
500000 500000 -84462 -88141 66082 -42728 -51534 8492 87024 -51053 -46657 -65482 -84566 25015 75859 17241 -80367 -96705 -48968 -39472 26382 -63638 89126 6784 20239 91981 -50116 -64446 8316 -91840 62002 -76657 6396 20060 65350 85101 -69463 16461 71644 47340 33461 -77765 -45992 -99011 10371 72086 42468...
output:
24997574286813795 24997593578536523 24997583886102441 24997593728194163 24997551354790195 24997519958850867 24997530857361907 24997560658303836 24997592054243164 24997597280670083 24997567479728154 24997563357846415 24997562743054666 24997597589811321 24997596678167068 24997591451740149 249975923633...
result:
ok 500000 lines
Test #12:
score: 0
Accepted
time: 458ms
memory: 28300kb
input:
500000 500000 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 23315 2331...
output:
4633301419 9266602838 9481917507 9697232176 5063930757 9697232176 5063930757 430629338 57666499462 68814346015 77988562807 82621864226 82406549557 82674184398 82691573217 90036097739 90018708920 120785400551 126906373306 120785400551 160309186805 169411244860 174309191283 182132073382 185590046403 1...
result:
ok 500000 lines
Test #13:
score: 0
Accepted
time: 0ms
memory: 9984kb
input:
100 100 10 -1 7 10 6 0 -6 1 -2 -10 -3 8 8 6 5 10 5 8 -8 7 -6 6 10 9 -5 -5 -1 -9 -7 0 -6 2 2 6 -6 2 -9 7 1 4 10 1 -1 -7 -7 4 -7 -5 -4 -5 -7 -6 -1 8 -4 10 -2 -7 9 -5 4 6 9 2 8 5 -4 7 2 6 4 -4 -6 7 -1 1 -4 10 -4 4 -1 2 -3 7 -2 -5 4 8 -9 -3 -7 3 3 -8 -4 -6 3 -6 9 -9 + 11 + 63 + 100 + 1 - 69 + 95 + 94 + ...
output:
87561 87665 87655 87754 87759 87762 87733 87726 87691 87691 87680 87675 89445 89336 90815 90812 90818 90819 90820 90817 90806 90807 90818 90821 90832 90835 90815 90810 90807 90817 90846 90839 90804 90807 90804 90819 90834 90914 90876 90872 90883 91257 91257 91262 91999 92012 92013 92013 92008 92015 ...
result:
ok 100 lines
Test #14:
score: 0
Accepted
time: 432ms
memory: 29412kb
input:
500000 500000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -...
output:
24999949999999997 24999949999999994 24999949999999991 24999993576533458 24999993576533455 24999993576533458 25000056071183135 25000056071183132 25000058304210031 25000058304210028 25000092108652451 25000092108652448 25000101484742747 25000101484742750 25000101484742753 25000085782690830 250000764066...
result:
ok 500000 lines
Test #15:
score: 0
Accepted
time: 447ms
memory: 30284kb
input:
500000 500000 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 80001 8000...
output:
42339799843 45383875254 49284061703 60873242339 62630303518 64299196641 68199383090 77787173239 101927884956 100258991833 160104055520 156203869071 160104055520 156203869071 96358805384 94601744205 103369110140 117459019587 118288036090 110636443667 109651005618 115305675131 118284987943 10257786585...
result:
ok 500000 lines
Test #16:
score: 0
Accepted
time: 442ms
memory: 27404kb
input:
500000 500000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -...
output:
24999949999999997 24999949999999994 24999949999999991 24999949999999988 24999949999999985 24999949999999982 24999949999999979 24999949999999976 24999999949192983 24999999949192986 24999999949192989 24999999949192986 24999999949192989 25000002235015500 25000002235015497 25000002235015500 250000013481...
result:
ok 500000 lines
Test #17:
score: 0
Accepted
time: 133ms
memory: 30588kb
input:
500000 500000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000...
output:
499999 999998 1499997 1999996 2499995 2999994 3499993 3999992 4499991 4999990 5499989 5999988 6499987 6999986 7499985 7999984 8499983 8999982 9499981 9999980 10499979 10999978 11499977 11999976 12499975 12999974 13499973 13999972 14499971 14999970 15499969 15999968 16499967 16999966 17499965 1799996...
result:
ok 500000 lines
Test #18:
score: 0
Accepted
time: 128ms
memory: 30384kb
input:
500000 500000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -10000...
output:
499999 999998 1499997 1999996 2499995 2999994 3499993 3999992 4499991 4999990 5499989 5999988 6499987 6999986 7499985 7999984 8499983 8999982 9499981 9999980 10499979 10999978 11499977 11999976 12499975 12999974 13499973 13999972 14499971 14999970 15499969 15999968 16499967 16999966 17499965 1799996...
result:
ok 500000 lines
Test #19:
score: 0
Accepted
time: 151ms
memory: 29420kb
input:
500000 500000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 1...
output:
25000012500249999 25000075000499998 25000137500749997 25000200000999996 25000262501249995 25000325001499994 25000387501749993 25000450001999992 25000512502249991 25000575002499990 25000637502749989 25000700002999988 25000762503249987 25000825003499986 25000887503749985 25000950003999984 250010125042...
result:
ok 500000 lines
Test #20:
score: 0
Accepted
time: 225ms
memory: 30456kb
input:
500000 500000 90318 -75898 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 -12425 ...
output:
292580101461 292580101458 292580101461 292580101458 292580101461 292580101458 292580101461 292580101462 292580101461 292580101462 292580101461 292580101458 292580101461 292580101458 292580101453 292580101446 292580101453 292580101446 292580101453 292580101458 292580101461 292580101458 292580101453 2...
result:
ok 500000 lines
Test #21:
score: 0
Accepted
time: 0ms
memory: 9668kb
input:
100 100 -12 -10 -8 -9 -9 -9 -10 -7 -7 -7 -7 -6 -6 -6 -7 -7 -3 -4 -6 -4 -2 -1 -1 -1 0 0 1 -2 0 2 4 2 5 6 5 6 7 7 7 7 7 7 8 9 9 9 12 8 10 12 9 9 10 8 9 7 7 7 7 7 6 7 4 6 5 4 5 4 4 2 3 1 2 -1 -3 0 -2 0 0 -4 -2 -3 -4 -3 -5 -5 -6 -6 -6 -6 -7 -7 -8 -7 -9 -8 -9 -10 -9 -10 + 32 - 46 - 72 + 89 - 99 + 15 - 30...
output:
62027 62032 62117 62152 62149 62147 62159 62154 62154 61700 61615 61582 61591 61580 61536 61664 61485 61333 61464 61449 61697 61688 61608 59071 59133 59121 58993 58999 58900 58808 59080 59089 59079 59142 59083 59083 59008 59099 59008 58680 58721 58694 58674 58471 58296 58293 58300 58340 58334 58147 ...
result:
ok 100 lines
Test #22:
score: 0
Accepted
time: 5ms
memory: 7976kb
input:
300 10000 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37...
output:
10439 0 20487 38976 18489 24788 26515 48108 55219 55458 55039 53960 61735 54624 55631 63846 64457 63612 55397 58477 57866 60681 68896 62656 62811 63585 63430 69589 64910 65065 65224 64822 67084 71503 71248 64825 85668 74399 82070 95789 82070 94759 104976 92287 85127 86911 76694 61899 51955 54519 628...
result:
ok 10000 lines
Test #23:
score: 0
Accepted
time: 5ms
memory: 7744kb
input:
300 10000 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -100 100 -1...
output:
8987099 8990634 8993261 9014576 9014573 9037202 9047341 9047338 9069975 9047338 9047335 9069964 9069967 9069964 9092593 9115222 9115219 9092590 9069961 9069958 9047329 9047332 9046019 9046022 9046019 9046022 9046019 9046022 9046025 9046022 9049165 9046956 9041029 9041026 9063655 9041026 9043705 9043...
result:
ok 10000 lines
Test #24:
score: 0
Accepted
time: 44ms
memory: 9768kb
input:
1 500000 56341 + 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 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 0 0 0 0 0 0 0 ...
result:
ok 500000 lines
Test #25:
score: 0
Accepted
time: 54ms
memory: 28392kb
input:
500000 1 87264 -46622 83983 29780 -26107 34378 47137 -46083 49909 -24411 -48502 52566 -98788 -96543 -38478 29848 62915 4353 37968 13624 10437 -24703 -97034 -30965 -31685 -85360 31834 -34540 68700 45597 -84104 -46937 82101 -64326 58652 93388 29079 28646 -5930 4070 20172 -64537 77467 41029 26395 7374 ...
output:
24998054791576670
result:
ok single line: '24998054791576670'
Test #26:
score: 0
Accepted
time: 227ms
memory: 9796kb
input:
1023 500000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -10...
output:
104550599997 104550599994 104550599997 104550599994 104550599991 104550599994 104550599991 104550599994 104550845496 104550599994 104550603056 104550603059 104550603062 104550861841 104551121190 104551119553 104550860774 104550914923 104550810614 104551054801 104551054798 104551054795 104551054792 1...
result:
ok 500000 lines
Test #27:
score: 0
Accepted
time: 228ms
memory: 9996kb
input:
1024 500000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -100000 100000 -10...
output:
104755379423 104755200000 104755199997 104755199994 104755199997 104755199994 104755458867 104755458870 104755199997 104755379420 104755199997 104755335560 104755598173 104755603760 104755603763 104755603760 104755468197 104755462610 104755523809 104755542968 104755542965 104755542962 104755573261 1...
result:
ok 500000 lines
Extra Test:
score: 0
Extra Test Passed