Submission #1322959

#TimeUsernameProblemLanguageResultExecution timeMemory
1322959baqbergenPIN (CEOI10_pin)C++20
0 / 100
79 ms70512 KiB
#include <bits/stdc++.h>
#define al long long
#define pb push_back
#define f first
#define s second
#define ap cout
#define ak "\n"
#define all(x) x.begin(),x.end()
#define ok  cout << __LINE__ << "| "<< "----------OK--------- -----" << endl;
#define deb(x) cout << __LINE__ << "| "<< #x  << " = " << x<< endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define af(x) ap<<x;
#define ai(x) af((x ? out[1] : out[0]))
#define cin(n,b) for(al i=1;i<=n;i++)cin>>b[i];
using namespace std;
const al nn=2e6+9;
const string out[2]={"NO","YES"};
al n,d,res;
string s[nn];
set<string>a[20];
void tp(){
	cin>>n>>d;
	for(al i=1;i<=n;i++){
		cin>>s[i];
		s[i]="#"+s[i];
	}
	if(d==1){
		for(al i=1;i<=n;i++){
			for(al j=1;j<=4;j++){
				string t;
				for(al k=1;k<=4;k++){
					if(j==k)continue;
					t+=s[i][k];
				}
				a[j].insert(t);
			}
		}
		for(al i=1;i<=n;i++){
			res+=4-a[i].size();
		}
		af(res);
	}
}
signed main(){
    fast;
    al tt=1;
    //cin>>tt;
    while(tt--){
        tp();
        ap<<ak;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...