| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 96661 | noneTP | Parametriziran (COCI19_parametriziran) | C++14 | 2307 ms | 42820 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef tuple<int, int, int> tp;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
typedef pair<LL, int> pli;
typedef pair<LL, LL> pll;
typedef pair<pii, int> piipi;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;
typedef pair<LL, pii> plpii;
typedef pair<LD, LD> pdd;
typedef pair<LD, int> pdi;
typedef pair<LD, LL> pdl;
typedef pair<int, LD> pid;
typedef pair<LL, LD> pld;
const int mod = 1e9 + 7;
const int hf = 999983;
const int N = 1e6;
int hv[10];
char s[10];
map<int, int> dp[64][64];
int main(){
LL ans = 0;
hv[0] = 1;
for(int i=1;i<10;i++) hv[i] = (hv[i-1]*1ll*hf)%mod;
int n, m;
scanf("%d%d", &n, &m);
for(int i=1;i<=n;i++){
scanf("%s", s);
int b = 0;
for(int j=0;j<m;j++){
if(s[j] == '?') b+=(1<<j);
}
for(int j=0;j<(1<<m);j++){
int c = (b|j), val = 0;
for(int k=0;k<m;k++){
if((c>>k)&1) continue;
val = (val + hv[k]*1ll*s[k])%mod;
}
c ^= j;
if(dp[j][c].count(val)) ans = (ans + dp[j][c][val]);
}
vector<int> v;
int x = (1<<m)-1 - b;
for(int j=0;j<m;j++){
if((x>>j)&1) v.push_back(j);
}
int sz = v.size();
for(int j=0;j<(1<<sz);j++){
int c = 0, val = 0;
for(int k=0;k<sz;k++){
if((j>>k)&1) c |= (1<<v[k]);
else val = (val + hv[v[k]]*1ll*s[v[k]])%mod;
}
dp[b][c][val]++;
}
}
printf("%lld\n", ans);
}
컴파일 시 표준 에러 (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... | ||||
