题解|01回文
01回文
https://ac.nowcoder.com/acm/contest/120562/I
#include<bits/stdc++.h>
using namespace std;
int main(){
/*ios::sync_with_stdio(false);
cin.tie(nullptr)
cout.tie(nullptr);关同步提速*/
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while(T--){
int n, m;
cin >> n >> m;
vector s(n, string(m, '0'));
array<int, 50> mp = {};
for(auto &i : s){
cin >> i;
for(auto &j : i){
mp[j]++;
}
}
for(auto &i : s){
for(auto &j : i){
cout << "YN"[mp[j] == 1];//以后遇见if else结构可以采用这种方式简化代码
}
cout << "\n";
}
}
}
错因:此题思路倒是得出来了,比赛的时候代码不能写对
思路:只要输入的里面有两个0或者1就可以,主要是对代码和时间复杂度的分析
