| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 39165 | LYLAKIOI | 【BJ】T2 | C++ | 通过 | 100 | 612 MS | 66652 KB | 1542 | 2025-12-24 19:03:09 |
#include<bits/stdc++.h> #define up(i,l,r) for(int i=(l);i<=(r);++i) #define down(i,l,r) for(int i=(l);i>=(r);--i) #define pi pair<int,int> #define p1 first #define p2 second #define m_p make_pair #define pb push_back #define eb emplace_back using namespace std; typedef long long ll; inline ll read(){ ll x=0;short t=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();} while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar(); return x*t; } const int maxn=1e6+10; int n,m,res[maxn],del[maxn],x[4]; int G[maxn][4]; int hd[maxn][2],to[maxn*3],nxt[maxn*3],cnt; void link(int x,int y,int z){ ++cnt;nxt[cnt]=hd[x][y];hd[x][y]=cnt;to[cnt]=z; } void slv(){ n=read(),m=read();read(); up(i,1,m){ up(j,1,3)x[j]=read(); up(j,1,3){ int y=read(); link(x[j],y,i); G[i][j]=x[j]; } } up(i,1,n){ auto f=[&](int p){ int res=0; for(;p;p=nxt[p])if(!del[to[p]]){ int id=to[p],cnt=4; up(j,1,3)if(G[id][j]>i)cnt/=2; res+=cnt; } return res; }; if(f(hd[i][0])>f(hd[i][1])){ for(int p=hd[i][0];p;p=nxt[p])del[to[p]]=1; }else{ res[i]=1; for(int p=hd[i][1];p;p=nxt[p])del[to[p]]=1; } } up(i,1,n)printf("%d ",res[i]); } int main(){ //freopen("sat.in","r",stdin),freopen("sat.out","w",stdout); slv(); return 0; }