点击跳转例题
思路:
//我们发现只跟相对位置有关,周期为4;
//对于每个相对位置,那么我么基本的条件就G的数量为3,R的数量为2,Y的数量为1;
//那么考虑是不是这样就行了呢
//是的,我们可以通过Y来中转使得满足;
代码:
#include <bits/stdc++.h> #define int long long //(有超时风险) #define PII pair<int,int> #define endl '\n' #define LL __int128 using namespace std; const int N=2e5+10,M=1e3+10,mod=998244353,INF=0x3f3f3f3f; int a[N],b[N],c[N],pre[N]; //我们发现只跟相对位置有关,周期为4; //对于每个相对位置,那么我么基本的条件就G的数量为3,R的数量为2,Y的数量为1; //那么考虑是不是这样就行了呢 //是的,我们可以通过Y来中转使得满足; signed main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n;cin>>n; while (n--) { string s1,s2,s3;cin>>s1>>s2>>s3; int flag=0; for(int i=0;i<4;i++) { map<char,int>mp; mp[s1[i]]++,mp[s1[i+4]]++,mp[s1[i+8]]++; mp[s2[i]]++,mp[s2[i+4]]++; mp[s3[i]]++; if(mp['Y']!=1||mp['R']!=2||mp['G']!=3) { flag=1; } } if(flag) cout<<"NO"<<endl; else cout<<"YES"<<endl; } return 0; }
P8700 [蓝桥杯 2019 国 B] 解谜游戏--2024蓝桥杯冲刺省一
最新推荐文章于 2024-08-07 10:35:41 发布