Submission #75698213


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#include "atcoder/all"
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//using mint=modint998244353;
void solve(){
    int n,m;
    cin>>n>>m;
    int num=n;
    string t="";
    vector<string>s(n);
    rep(i,n)cin>>s[i];
    vector<int>a(n,0);
    rep(i,m){
        int tmp=0;
        rep(j,n)if(s[j][i]=='1' and a[j]==0)tmp++;
        if(tmp>num-tmp){
            t.push_back('1');
            rep(j,n)if(s[j][i]=='1' and a[j]==0){
                a[j]=1;
                num--;
            }
        }
        else{
            t.push_back('0');
            rep(j,n)if(s[j][i]=='0' and a[j]==0){
                a[j]=1;
                num--;
            }
        }
    }
    if(num==0){
        cout<<"Yes"<<endl;
        cout<<t;
    }
    else cout<<"No";
}
int main(){
    ios::sync_with_stdio(false);
	cin.tie(nullptr);
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Submission Info

Submission Time
Task A - Similarity
User itoito1234
Language C++23 (GCC 15.2.0)
Score 400
Code Size 995 Byte
Status AC
Exec Time 31 ms
Memory 6336 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 62
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt
All 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-allbut-01.txt, 01-allbut-02.txt, 01-allbut-03.txt, 01-allbut-04.txt, 01-allbut-05.txt, 01-allbut-06.txt, 01-allbut-07.txt, 01-allbut-08.txt, 01-allbut-09.txt, 01-allbut-10.txt, 01-allbut-11.txt, 01-allbut-12.txt, 01-allbut-13.txt, 01-allbut-14.txt, 01-allbut-15.txt, 01-allbut-16.txt, 01-allbut-17.txt, 01-allbut-18.txt, 01-allbut-19.txt, 01-allbut-20.txt, 01-allbut-21.txt, 01-allbut-22.txt, 01-allbut-23.txt, 01-allbut-24.txt, 01-allbut-25.txt, 02-all-01.txt, 02-all-02.txt, 02-all-03.txt, 02-all-04.txt, 02-all-05.txt, 02-all-06.txt, 02-all-07.txt, 02-all-08.txt, 03-random-01.txt, 03-random-02.txt, 03-random-03.txt, 03-random-04.txt, 03-random-05.txt, 03-random-06.txt, 03-random-07.txt, 03-random-08.txt, 03-random-09.txt, 03-random-10.txt, 03-random-11.txt, 03-random-12.txt, 03-random-13.txt, 03-random-14.txt, 04-killer-01.txt, 04-killer-02.txt, 04-killer-03.txt, 04-killer-04.txt, 04-killer-05.txt, 04-killer-06.txt, 04-killer-07.txt, 04-killer-08.txt, 05-random2-01.txt, 05-random2-02.txt, 05-random2-03.txt, 05-random2-04.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 1 ms 3428 KiB
00-sample-02.txt AC 1 ms 3528 KiB
00-sample-03.txt AC 1 ms 3472 KiB
01-allbut-01.txt AC 1 ms 3428 KiB
01-allbut-02.txt AC 1 ms 3372 KiB
01-allbut-03.txt AC 1 ms 3400 KiB
01-allbut-04.txt AC 1 ms 3408 KiB
01-allbut-05.txt AC 1 ms 3380 KiB
01-allbut-06.txt AC 1 ms 3444 KiB
01-allbut-07.txt AC 1 ms 3388 KiB
01-allbut-08.txt AC 1 ms 3440 KiB
01-allbut-09.txt AC 1 ms 3400 KiB
01-allbut-10.txt AC 1 ms 3384 KiB
01-allbut-11.txt AC 1 ms 3440 KiB
01-allbut-12.txt AC 1 ms 3472 KiB
01-allbut-13.txt AC 1 ms 3440 KiB
01-allbut-14.txt AC 1 ms 3476 KiB
01-allbut-15.txt AC 1 ms 3472 KiB
01-allbut-16.txt AC 1 ms 3676 KiB
01-allbut-17.txt AC 2 ms 3564 KiB
01-allbut-18.txt AC 2 ms 3800 KiB
01-allbut-19.txt AC 3 ms 3692 KiB
01-allbut-20.txt AC 3 ms 3668 KiB
01-allbut-21.txt AC 3 ms 3668 KiB
01-allbut-22.txt AC 5 ms 3796 KiB
01-allbut-23.txt AC 5 ms 3948 KiB
01-allbut-24.txt AC 5 ms 3964 KiB
01-allbut-25.txt AC 5 ms 3864 KiB
02-all-01.txt AC 1 ms 3416 KiB
02-all-02.txt AC 1 ms 3416 KiB
02-all-03.txt AC 1 ms 3340 KiB
02-all-04.txt AC 1 ms 3428 KiB
02-all-05.txt AC 1 ms 3516 KiB
02-all-06.txt AC 1 ms 3700 KiB
02-all-07.txt AC 2 ms 3692 KiB
02-all-08.txt AC 2 ms 3904 KiB
03-random-01.txt AC 1 ms 3444 KiB
03-random-02.txt AC 1 ms 3676 KiB
03-random-03.txt AC 2 ms 3480 KiB
03-random-04.txt AC 2 ms 3640 KiB
03-random-05.txt AC 2 ms 3928 KiB
03-random-06.txt AC 8 ms 4944 KiB
03-random-07.txt AC 11 ms 4916 KiB
03-random-08.txt AC 13 ms 5312 KiB
03-random-09.txt AC 18 ms 5540 KiB
03-random-10.txt AC 19 ms 5464 KiB
03-random-11.txt AC 19 ms 5552 KiB
03-random-12.txt AC 24 ms 5828 KiB
03-random-13.txt AC 30 ms 6224 KiB
03-random-14.txt AC 31 ms 6208 KiB
04-killer-01.txt AC 16 ms 6068 KiB
04-killer-02.txt AC 15 ms 6228 KiB
04-killer-03.txt AC 16 ms 6336 KiB
04-killer-04.txt AC 16 ms 6168 KiB
04-killer-05.txt AC 30 ms 6148 KiB
04-killer-06.txt AC 31 ms 6084 KiB
04-killer-07.txt AC 31 ms 6200 KiB
04-killer-08.txt AC 30 ms 6100 KiB
05-random2-01.txt AC 2 ms 3644 KiB
05-random2-02.txt AC 2 ms 3648 KiB
05-random2-03.txt AC 2 ms 3896 KiB
05-random2-04.txt AC 2 ms 3868 KiB