답안 #314662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
314662 2020-10-20T15:38:22 Z ronnith Parametriziran (COCI19_parametriziran) C++14
0 / 110
800 ms 4600 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define num(a) a-'0'
#define charr(a) (a - 'A' + 1)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define bin1(a) __builtin_popcount(a)
#define debug(x) cerr<<"["<<#x<<":"<<x<<"] "
#define debug2(a,b) debug(a);debug(b)
#define debug3(a,b,c) debug2(a,b);debug(c)
#define de cerr
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/(__gcd(a,b))
#define print(arr) for(auto it = arr.begin();it < arr.end();it ++){cout << *it << " ";}cout << ln;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define all(a) (a).begin(), (a).end()
#define vi vector<long long>
#define v vector
#define p pair
#define pii p<int,int>
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long double ld;
typedef double d;
using namespace std;
using namespace __gnu_pbds;
int modF=1e9+7;

/*OUTPUT

*/

int ans = 0;
// v<string> a;
set<string> st;

void chk(string s,int i,string b){
	if(i == 2){
		// debug(b);
		if(st.find(b) != st.end()){
			ans ++;
		}
	}
	else{
		if(s[i] == '?'){
			for(int j = 0;j < 26;j ++){
				char ch = (char)(j + 97);
				b[i] = ch;
				chk(s,i + 1,b);
			}
			b[i] = '?';
			chk(s,i + 1,b);
		}
		else{
			b[i] = s[i];
			chk(s,i + 1,b);
			b[i] = '?';
			chk(s,i + 1,b);
		}
	}
}

void solve(){
	int n,m;
	cin >> n >> m;
	string x;
	for(int i = 0;i < n;i ++){
		cin >> x;
		// a.pb(x);
		chk(x,0,"  ");
		st.insert(x);
	}
	cout << ans << ln;
}

signed main(){
  boost_io;
  int t=1;
  // cin>>t;
  while(t--){
    solve();
  }
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 384 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 91 ms 524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 194 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 174 ms 1400 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 800 ms 1272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 307 ms 3960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 468 ms 3192 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 194 ms 3960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 223 ms 3064 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 474 ms 4600 KB Output isn't correct
2 Halted 0 ms 0 KB -