QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#648289#7752. The Only Way to the DestinationLavender_Field#Compile Error//C++202.8kb2024-10-17 18:07:592024-10-17 18:08:05

Judging History

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

  • [2024-10-17 18:08:05]
  • 评测
  • [2024-10-17 18:07:59]
  • 提交

answer

#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int N=5e5+5;
int T,n,m,k;
struct node{
    int x[3],y;
}a[N];
vector<node> vec[N];
bool cmp(node i,node j){
    if(i.y!=j.y) return i.y<j.y;
    return i.x[1]<j.x[1];
}
int fa[N];
int find(int x){
    return (fa[x]==x)?(fa[x]):(fa[x]=find(fa[x]));
}
struct EmptyNode{
    int l,r,id;
}b[N];
int cnt;
int check(EmptyNode i,EmptyNode j){
    if (!((i.l<=j.r)&&(i.r>=j.l))) return 0;
    if(i.l>j.l && i.r<j.r) return i.r-i.l+1;
    if(j.l>i.l && j.r<i.r) return j.r-j.l+1;
    if(i.r<j.r) return i.r-j.l+1;
    return j.r-i.l+1;
}
bool solve(){
    scanf("%d%d%d",&m,&n,&k);
    if(n>2*k+1) return 0;
    for(int i=1;i<=k;i++){
        scanf("%d%d%d",&a[i].x[1],&a[i].x[2],&a[i].y);
    }
    sort(a+1,a+1+k,cmp);
    a[0].y=0;
    for(int i=1;i<=k;i++){
        if(a[i].y-a[i-1].y>=3) return 0;
    }
    for(int i=1;i<=k;i++){
        vec[a[i].y].push_back(a[i]);
        // printf("%d\n",a[i].y);
    }
    vector<EmptyNode> tmp,tmp2;
    int now=1;
    for(auto x:vec[1]){
        if(x.x[1]-now>0){
            EmptyNode tmp3;
            tmp3.id=++cnt;
            fa[cnt]=cnt;
            tmp3.l=now;
            tmp3.r=x.x[1]-1;
            tmp.pb(tmp3);
            now=x.x[2]+1;
        }
    }
    if(now<=m){
        EmptyNode tmp3;
        tmp3.id=++cnt;
        fa[cnt]=cnt;
        tmp3.l=now;
        tmp3.r=m;
        tmp.pb(tmp3);
    }
    for(auto x:tmp){
        printf("[%d %d]\n",x.l,x.r);
    }
    // printf("A");
    // printf("fuck11 %d\n",n);
    for(int i=2;i<=n;i++){
        // printf("fuck %d\n",i);
        now=1;tmp2.clear();
        for(auto x:vec[i]){
            if(x.x[1]-now>0){
                EmptyNode tmp3;
                tmp3.id=++cnt;
                fa[cnt]=cnt;
                tmp3.l=now;
                tmp3.r=x.x[1]-1;
                tmp2.pb(tmp3);
                now=x.x[2]+1;
            }
        }
        if(now<=m){
            EmptyNode tmp3;
            tmp3.id=++cnt;
            fa[cnt]=cnt;
            tmp3.l=now;
            tmp3.r=m;
            tmp2.pb(tmp3);
        }
        for(auto x:tmp2){
            printf("%d: [%d %d]\n",i,x.l,x.r);
        }
        now=0;
        for(int i=0;i<tmp.size();i++){
            int same=check(tmp[i],tmp2[now]);
            printf("same %d\n",same);
            if(same>=2) return 0;
            while(now<tmp2.size() && same==1){
                if(find(tmp[i].id)==find(tmp2[now].id)){
                    return 0;
                }
                fa[find(tmp[i].id)]=find(tmp2[now].id);
            }
        }
        tmp.clear();
        for(auto x:tmp2) tmp.pb(x);
    }
    return 1;
}
isdasdant sdasdmain(){
    if(solve()) printf("YES\n");
    else printf("NO\n");
    return 0;
}sdasdasdadsadsdasdasdasdada

Details

answer.code:112:1: error: ‘isdasdant’ does not name a type
  112 | isdasdant sdasdmain(){
      | ^~~~~~~~~
answer.code:116:2: error: ‘sdasdasdadsadsdasdasdasdada’ does not name a type
  116 | }sdasdasdadsadsdasdasdasdada
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code: In function ‘bool solve()’:
answer.code:30:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |     scanf("%d%d%d",&m,&n,&k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
answer.code:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   33 |         scanf("%d%d%d",&a[i].x[1],&a[i].x[2],&a[i].y);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~