QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#470228#5504. Flower Garden11d10xyCompile Error//C++142.3kb2024-07-10 11:27:432024-07-10 11:27:43

Judging History

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

  • [2024-07-10 11:27:43]
  • 评测
  • [2024-07-10 11:27:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m,N,M,dfn[400010],low[400010],bl[400010],stk[400010],vis[400010],tot,tp,idin[100010<<2],idout[100010<<2];
vector<int>G[400010],D[400010],node[400010],ans,tmp;
void upd(){
   if(ans.empty()&&n<=tmp.size()&&tmp.size()<=n*2){
      ans.resize(n*3+1);
      for(int x:tmp)ans[x]=1;
   }
}
void build(int u,int l,int r){
   if(l==r)return idin[u]=idout[u]=l,void();
   int mid=l+r>>1;
   build(u<<1,l,mid),build(u<<1|1,mid+1,r);
   idin[u]=++N,idout[u]=++N;
   G[idin[u]].push_back(idin[u<<1]);
   G[idin[u]].push_back(idin[u<<1|1]);
   G[idout[u<<1]].push_back(idout[u]);
   G[idout[u<<1|1]].push_back(idout[u]);
}
void addin(int u,int l,int r,int L,int R,int x){
   if(L<=l&&r<=R)return G[x].push_back(idin[u]),void();
   int mid=l+r>>1;
   if(L<=mid)addin(u<<1,l,mid,L,R,x);
   if(R>mid)addin(u<<1|1,mid+1,r,L,R,x);
}
void addout(int u,int l,int r,int L,int R,int x){
   if(L<=l&&r<=R)return G[idout[u]].push_back(x),void();
   int mid=l+r>>1;
   if(L<=mid)addout(u<<1,l,mid,L,R,x);
   if(R>mid)addout(u<<1|1,mid+1,r,L,R,x);
}
void tarjan(int u){
   dfn[u]=low[u]=++tot,stk[++tp]=u,vis[u]=1;
   for(int v:G[u])if(!dfn[v])tarjan(v),low[u]=min(low[u],low[v]);
   else if(vis[v])low[u]=min(low[u],dfn[v]);
   if(dfn[u]==low[u]){
      int x,U=++M;
      do{
         x=stk[tp--],vis[x]=0,bl[x]=U;
         if(x<=3*n)node[U].push_back(x),tmp.push_back(x);
         for(int v:G[x])if(bl[v]!=U)D[U].push_back(bl[v]);
      }while(x!=u);
      upd();
   }
}
void dfs(int u){
   tmp.insert(end(tmp),begin(node[u]),end(node[u]));
   vis[u]=1;
   for(int v:D[u])if(!vis[v])dfs(v);
}
void solve(){
   cin>>n>>m,N=n*3;
   build(1,1,n*3);
   for(int a,b,c,d;m--;){
      scanf("%d%d%d%d",&a,&b,&c,&d);
      N++;
      addout(1,1,n*3,a,b,N);
      addin(1,1,n*3,c,d,N);
   }
   tmp={};
   for(int i=1;i<=n;i++)if(!dfn[i])tarjan(i);
   for(int i=1;ans.empty()&&i<=M;i++)if(node[i].size()>=n){
      tmp={},dfs(i),upd();fill_n(vis+1,M,0)
   }
   if(!ans.empty()){
      puts("TAK");
      for(int i=1;i<=n*3;i++)putchar(ans[i]==1?'F':'R');
      puts("");
   }else puts("NIE");
   for(int i=1;i<=N;i++)G[i]=D[i]=node[i]={},dfn[i]=low[i]=0;
   ans={},M=0;
}
int main(){
   int T;for(cin>>T;T--;)solve();
   return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:64:44: error: expected ‘;’ before ‘}’ token
   64 |       tmp={},dfs(i),upd();fill_n(vis+1,M,0)
      |                                            ^
      |                                            ;
   65 |    }
      |    ~                                        
answer.code:56:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   56 |       scanf("%d%d%d%d",&a,&b,&c,&d);
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~