QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#674770 | #7744. Elevator | lselegies | WA | 1ms | 3696kb | C++14 | 561b | 2024-10-25 17:24:58 | 2024-10-25 17:24:59 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+1;
int f[N];
signed main()
{
int t;
cin>>t;
int n,k,maxh=0;
while(t--)
{
memset(f,0,maxh);
maxh=0;
cin>>n>>k;
for (int i=1;i<=n;i++)
{
int s,v,h;
cin>>s>>v>>h;
f[h]+=s*v;
maxh=max(maxh,h);
}
int res=0,ans=0;
for (int i=maxh;i>=1;i--)
{
if (f[i])
{
if (f[i]>res)
{
f[i]-=res;
ans+=(f[i]+k-1)/k*i;
res=k-(f[i]%k);
}
else res-=f[i];
}
}
cout<<ans<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3696kb
input:
2 4 6 1 1 8 7 2 5 1 1 7 3 2 6 8 1200000 100000 1 100000 100000 1 12345 100000 2 100000 100000 2 12345 100000 1 100000 100000 1 12345 100000 2 100000 100000 2 12345
output:
24 100008
result:
wrong answer 2nd lines differ - expected: '100000', found: '100008'