| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 39166 | LYLAKIOIAKIOI | 【BJ】T2 | C++ | 通过 | 100 | 625 MS | 27624 KB | 1544 | 2025-12-24 19:13:22 |
#include<bits/stdc++.h> using namespace std; const int N=1e6+10; int n,m,tp; int A[N],B[N],C[N],X[N],Y[N],Z[N]; int w[N]; bool random_gen(){ for(int i=1;i<=n;i++) w[i]=rand()%2; int lim=(tp==0)?((m+1)/2):((7*m+7)/8); int cnt=0; for(int i=1;i<=m;i++){ if(w[A[i]]!=X[i]&&w[B[i]]!=Y[i]&&w[C[i]]!=Z[i]) cnt--;cnt++; } return (cnt>=lim); } int main(){ //freopen("sat.in","r",stdin); //freopen("sat.out","w",stdout); ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n>>m>>tp; for(int i=1;i<=m;i++){ cin>>A[i]>>B[i]>>C[i]>>X[i]>>Y[i]>>Z[i]; } while(!random_gen()); for(int i=1;i<=n;i++) cout<<w[i]<<' ';cout<<endl; return 0; } /* #include<bits/stdc++.h> #define AC 0 #define WA 1 using namespace std; FILE *In,*Out; const int N=1e6+10; int n,m,tp; int st[N]; int main(int argc,char *argv[]){ In=fopen(argv[1],"r"); Out=fopen(argv[2],"r"); fscanf(In,"%d%d%d",&n,&m,&tp); for(int i=1;i<=n;i++) fscanf(Out,"%d",&st[i]); int lim=(tp==0)?((m+1)/2):((7*m+7)/8); int cnt=0; for(int i=1;i<=m;i++){ int a,b,c,x,y,z; fscanf(In,"%d%d%d%d%d%d",&a,&b,&c,&x,&y,&z); if(st[a]!=x&&st[b]!=y&&st[c]!=z) cnt--;cnt++; } if(cnt>=lim){ fprintf(stderr,"OK. Your answer is %d, which is greater than %d\n",cnt,lim); return AC; }else{ fprintf(stderr,"WA. Your answer is %d, which is less than %d\n",cnt,lim); return WA; } return 0; } */