提交时间:2023-08-12 11:18:04

运行 ID: 27516

#include <bits/stdc++.h> using namespace std; int a[10500],b[10500],c[10500],g[5],x,maxn; int main() { int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]>>b[i]>>c[i]; for(int i=1;i<=3;i++) { x=0; g[i]=1; for(int j=1;j<=n;j++) { swap(g[a[j]],g[b[j]]); if(g[c[j]]==1) x++; cout<<endl<<x<<" "<<endl; for(int i=1;i<=3;i++) cout<<g[i]<<" "; } maxn=max(maxn,x); g[i]=0; } cout<<maxn; return 0; }