省略
省略
C++に変換後のコードはこちら
int H, W;
string A[1d5];
{
int cnt[2] = {}, fg[2] = {};
rd(H,W,A(H));
rep(i,H) rep(j,W) cnt[A[i][j]-='0']++;
if(H==1 || W==1) wt( if[cnt[0]==0 || cnt[1]==0, "NO", "YES"] ), return 0;
rep(i,H){
cnt[0] = cnt[1] = 0;
rep(j,W) cnt[A[i][j]]++;
if(cnt[0]==0 || cnt[1]==0) fg[0]++;
}
rep(i,W){
cnt[0] = cnt[1] = 0;
rep(j,H) cnt[A[j][i]]++;
if(cnt[0]==0 || cnt[1]==0) fg[1]++;
}
wt(if[fg[0]&&fg[1], "NO", "YES"]);
}
Current time: 2024年04月27日13時09分09秒
Last modified: 2019年11月10日18時37分17秒 (by laycrs)
Tags: Competitive_Programming_Incomplete yukicoder
トップページに戻る
Logged in as: unknown user (not login)