| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1323098 | baqbergen | PIN (CEOI10_pin) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#define al int
#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,ind;
string s[nn];
vector<string>a[20] ;
vector<char> c[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){
c[i].pb(s[i][j]);
}
else{
t+=s[i][k];
}
}
a[j].pb(t);
}
}
for(al i=1;i<=4;i++){
for(al j=1;j<=4;j++){
for(al k=j+1;k<=4;k++){
if(a[i][j]==a[i][k] and c[i][j]!=c[i][k])res++;
}
}
}
// for(al i=1;i<=n;i++){
// deb(i<<" suiii ");
// for(auto j:a[i]){
// deb(j);
// }
// deb("alonnee ")
// for(auto j:c[i]){
// deb(j);
// }
}
af(res);
}
}
signed main(){
fast;
al tt=1;
//cin>>tt;
while(tt--){
tp();
ap<<ak;
}
}
