QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#197257#686. Bad Doctorsky1102RE 0ms0kbC++14947b2023-10-02 13:49:232023-10-02 13:49:24

Judging History

你现在查看的是最新测评结果

  • [2023-10-02 13:49:24]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-10-02 13:49:23]
  • 提交

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;
}


Details

Tip: Click on the bar to expand more detailed information

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

output:


result: