QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#661509 | #5417. Chat Program | wsyjpgs | WA | 91ms | 19652kb | C++14 | 1.3kb | 2024-10-20 16:36:16 | 2024-10-20 16:36:24 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
long long a[500005];
int main()
{
long long n,k,m,c,d;
cin>>n>>k>>m>>c>>d;
priority_queue<long long,vector<long long>,greater<long long>> q;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(q.size()<k)
{
q.push(a[i]);
}
else if(a[i]>q.top())
{
q.pop();
q.push(a[i]);
}
}
long long p=q.top(),pos=0,st=0,ed=0;
long long sum=0,maxp=0,sump=0,posp=0;
while(ed<m-1)
{
if(a[ed]+c>p)
{
sum++;
}
if(a[ed]==p)
{
sump++;
}
ed++;
}
int i=st,j=ed;
while(j<n)
{
if(sum>maxp||(sum==maxp&&sump>posp))
{
st=i;
ed=j;
maxp=sum;
posp=sump;
}
//maxp=max(maxp,sum);
if(a[i]+c>p)
{
sum--;
if(a[i]==p)
{
sump--;
}
}
i++;
j++;
if(a[j]<=p)
{
sum++;
if(a[i]==p)
{
sump++;
}
}
}
//cout<<"st:"<<st<<"ed:"<<ed<<endl;
map<long long,long long> ma;
//cout<<"st:"<<st<<"ed:"<<ed<<endl;
for(int i=st;i<=ed;i++)
{
if(a[i]+c>p)
{
if(a[i]<=p)
{
q.pop();
q.push(a[i]+c);
p=q.top();
while(ma[p]>0)
{
ma[p]--;
q.pop();
q.push(p+c);
p=q.top();
}
}
else
{
ma[a[i]]++;
}
}
c+=d;
}
cout<<q.top()<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
input:
6 4 3 1 2 1 1 4 5 1 4
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
7 3 2 4 0 1 9 1 9 8 1 0
output:
9
result:
ok 1 number(s): "9"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
8 3 5 0 0 2 0 2 2 1 2 1 8
output:
2
result:
ok 1 number(s): "2"
Test #4:
score: 0
Accepted
time: 24ms
memory: 7312kb
input:
200000 200000 100000 0 1000000000 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 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 73ms
memory: 11856kb
input:
200000 1 100000 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:
100001000000000
result:
ok 1 number(s): "100001000000000"
Test #6:
score: 0
Accepted
time: 91ms
memory: 19652kb
input:
200000 1 200000 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:
200001000000000
result:
ok 1 number(s): "200001000000000"
Test #7:
score: -100
Wrong Answer
time: 57ms
memory: 8172kb
input:
200000 24420 17993 881138881 700368758 231187558 519018952 260661004 740633836 931672020 155904999 647179942 13217847 779799803 382810661 242588977 708308843 309853544 225488875 389115097 588643904 644409212 704920939 231829287 39891424 881158891 341251089 486868469 808002305 629160633 317239613 771...
output:
964183791
result:
wrong answer 1st numbers differ - expected: '964474978', found: '964183791'