QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#197257 | #686. Bad Doctor | sky1102 | RE | 0ms | 0kb | C++14 | 947b | 2023-10-02 13:49:23 | 2023-10-02 13:49:24 |
answer
#include <bits/stdc++.h>
#define up(i,a,b) for(int i=a;i<=b;i++)
#define down(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long LL;
const int MAXN = 1e6+7;
const int MAXN2= 5e3+7;
const int MOD = 1e9+7;
struct N{
int l,r,k,c[MAXN2];
}M[MAXN2];
int n,m;
int cost[MAXN2];
int main() {
freopen("doctor.in","r",stdin);
freopen("doctor.out","w",stdout);
int L=MAXN2,R=-MAXN2;
scanf("%d %d",&n,&m);
up(i,1,m)scanf("%d",&cost[i]);
up(i,1,n){
scanf("%d %d %d",&M[i].l,&M[i].r,&M[i].k);
L=min(L,M[i].l);
R=max(R,M[i].r);
up(j,1,M[i].k){
int idx;
scanf("%d",&M[i].c[j]);
}
}
up(k,1,n){
LL ans = 0;
up(i,L,R){
bool vis[MAXN2]={};
up(j,1,n){
if(j==k)continue;
up(x,1,M[j].k){
if(i>=M[j].l&&i<=M[j].r&&(vis[M[j].c[x]]==0)){
vis[M[j].c[x]]=1;
ans+=cost[M[j].c[x]];
}
}
}
}
printf("%lld ",ans);
}
return 0;
}
详细
Test #1:
score: 0
Dangerous Syscalls
input:
5 4 1000 100 10 1 3 4 2 2 3 4 8 3 1 2 4 6 7 2 3 4 8 9 2 1 4 2 6 3 1 2 3