QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#618342 | #6606. The Boomsday Project | Soestx | TL | 2ms | 15412kb | C++23 | 1.0kb | 2024-10-06 21:10:27 | 2024-10-06 21:10:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define lowbit(x) (x&(-x))
typedef long long ll;
//typedef unsigned long long ull;
const int N = 1e6 + 10, M = 1e5, mod = 998244353;
int n, m, k;
int res;
int num[N];
struct stu
{
int d,k,c;
}st[N];
int dp[N];
void solve() {
cin>>n>>m>>k;
int idx=0;
for(int i=1;i<=n;i++) cin>>st[i].d>>st[i].k>>st[i].c;
for(int i=1;i<=m;i++)
{
int p,q;
cin>>p>>q;
while(q--) num[++idx]=p;
}
sort(num+1,num+1+idx);
memset(dp,0x3f,sizeof dp);
dp[0]=0;
for(int i=1;i<=idx;i++)
{
if(dp[i]>dp[i-1]+k) dp[i]=dp[i-1]+k;
for(int j=1;j<=n;j++)
{
int to=i;
to=upper_bound(num+1,num+1+idx,num[i]+st[j].d-1)-num-1;
if(to-i+1>=st[j].k) to=i+st[j].k-1;
if(dp[to]>dp[i-1]+st[j].c) dp[to]=dp[i-1]+st[j].c;
}
}
cout<<dp[idx]<<endl;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T;
T = 1;
//cin >> T;
while (T--) solve();
return 0;
}
/*
*/
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 15412kb
input:
2 1 10 1 3 12 1 2 9 1 10
output:
42
result:
ok 1 number(s): "42"
Test #2:
score: 0
Accepted
time: 0ms
memory: 15168kb
input:
2 4 10 1 3 12 1 2 9 1 3 2 3 3 3 4 1
output:
45
result:
ok 1 number(s): "45"
Test #3:
score: -100
Time Limit Exceeded
input:
500 100 1000 95 20 20892 73 627 55354 52 747 1404314 19 676 597007 65 814 1569851 91 397 691575 81 4 4575 97 382 624404 21 197 201850 67 799 643576 27 895 1510533 3 800 552439 49 954 1149851 70 892 676406 82 882 1348956 1 318 324094 43 238 439111 94 397 471003 16 119 130686 1 637 77731 79 292 35234 ...