QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#792017#686. Bad DoctorAme_Rain_chanRE 0ms0kbC++142.2kb2024-11-28 22:53:462024-11-28 22:53:47

Judging History

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

  • [2024-11-28 22:53:47]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-11-28 22:53:46]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=5e5+10;
int n,m,c[N];
struct pt{
    int l,r;
}p[N];
vector<int> x[N];
unordered_set<int> st[N];
int main(){
    freopen("doctor.in","r",stdin);
    freopen("doctor.out","w",stdout);

    scanf("%d%d",&n,&m);
    for(int i=1;i <= m;i++) scanf("%d",&c[i]);
    int mi=1e9,ma=-1e9;
    for(int i=1;i <= n;i++){
        int t;scanf("%d%d%d",&p[i].l,&p[i].r,&t);
        mi=min(mi,p[i].l),ma=max(ma,p[i].r);
        for(int j=1;j <= t;j++){
            int q;scanf("%d",&q);
            x[i].push_back(q);
        }
    }
    if(n <= 310 && m <= 310){
        for(int i=1;i <= n;i++){
            ll res=0;
            for(int j=mi;j <= ma;j++) st[j].clear();
            //cerr << "delete: " << i << "\n";
            for(int j=1;j <= n;j++){
                if(j == i) continue;
                //cerr << "message: " << p[j].l << " " << p[j].r << "\n";
                for(int k=p[j].l;k <= p[j].r;k++){
                    
                    for(auto t:x[j]){
                        if(st[k].count(t)) continue;
                        st[k].insert(t);
                        res += c[t];
                        //cerr << k << " " << t << "\n";
                    }
                    
                }
                
            }
            printf("%lld ",res);
        }
    } else {
        for(int i=1;i <= n;i++){
            ll res=0;int mi=1e9,ma=-1e9;
            for(int j=1;j <= n;j++){
                if(j == i) continue;
                for(int k=p[j].l;k <= p[j].r;k++){
                    
                    for(auto t:x[j]){
                        if(st[k].count(t)) continue;
                        st[k].insert(t);
                        res += c[t];
                        //cerr << k << " " << t << "\n";
                    }
                    
                }
                printf("%lld ",res);
            }
            /*
            for(int j=mi;j <= ma;j++){
                res +=  0;
            }
            */
        }
    }
    
    return 0;
}

/*
g++ doctor.cpp -o doctor -std=c++14 -O2 -static -Wall -Wextra -fsanitize=undefined
./doctor < doctor.in > doctor.out
*/

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: