# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
104579 | Hassoony | Parametriziran (COCI19_parametriziran) | C++17 | 410 ms | 3820 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=(1e9+7);
const ll inf=(1ll<<61);
const int MX=50009;
int n,m;
vector<string>v[(1<<7)];
string s;
unordered_map<string,int>vis;
char oo[8];
ll ans=0;
void add(string s){
int ret=0;
string tmp="";
for(int j=0;j<m;j++){
if(s[j]!='?')ret+=(1<<j);
}
v[ret].push_back(s);
}
int main(){
cin>>n>>m;
for(int i=0;i<n;i++){
scanf("%s",&oo);s=oo;
add(s);
}
for(int i1=0;i1<(1<<m);i1++){
for(int j1=i1+1;j1<(1<<m);j1++){
int mask1=i1,mask2=j1;
vis.clear();
for(auto pp:v[mask1]){
string tmp="";
for(int j=0;j<m;j++){
if((mask1&(1<<j))&&(mask2&(1<<j)))tmp+=pp[j];
}
vis[tmp]++;
}
for(auto pp:v[mask2]){
string tmp="";
for(int j=0;j<m;j++){
if((mask1&(1<<j))&&(mask2&(1<<j)))tmp+=pp[j];
}
ans+=vis[tmp];
}
}
}
cout<<ans<<endl;
}
/*
3 3
??b
c??
c?c
4 6
ab??c?
??kll?
a?k??c
?bcd??
5 2
??
b?
c?
?g
cg
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |