Submission #198864

# Submission time Handle Problem Language Result Execution time Memory
198864 2020-01-27T22:41:35 Z ZwariowanyMarcin Parametriziran (COCI19_parametriziran) C++14
110 / 110
458 ms 1888 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define ss(x) (int) x.size()
#define pb push_back
#define LL long long
#define ld long double
#define cat(x) cerr << #x << " = " << x << endl
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define boost cin.tie(0), ios_base::sync_with_stdio(0);


using namespace std;		

const int N = 50005;

bitset <N> b[6][26];
bitset <N> a, d;

int n, m;
char s[N][10];

int main() {	
	scanf ("%d%d", &n, &m);
	for (int i = 0; i < n; ++i) {
		scanf ("%s", s[i]);
		for (int j = 0; j < m; ++j) {
			if (s[i][j] == '?')
				for (int c = 0; c < 26; ++c)
					b[j][c][i] = 1;
			else
				b[j][s[i][j] - 'a'][i] = 1;
		}
	}
	
	LL ans = 0;
	for (int i = 0; i < n; ++i) d[i] = i;
	for (int i = 0; i < n; ++i) {
		d[i] = 0;
		a.set();
		a = (a & d);
		for (int j = 0; j < m; ++j) 
			if (s[i][j] != '?')
				a = (a & b[j][s[i][j] -'a']);
		ans += a.count();
	}
	printf ("%lld", ans);
		
		
	
	return 0;
}

Compilation message

parametriziran.cpp: In function 'int main()':
parametriziran.cpp:25:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf ("%d%d", &n, &m);
  ~~~~~~^~~~~~~~~~~~~~~~
parametriziran.cpp:27:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%s", s[i]);
   ~~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 238 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 169 ms 1016 KB Output is correct
2 Correct 155 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 211 ms 1144 KB Output is correct
2 Correct 285 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 201 ms 1144 KB Output is correct
2 Correct 167 ms 1268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 280 ms 1348 KB Output is correct
2 Correct 132 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 360 ms 1528 KB Output is correct
2 Correct 221 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 287 ms 1528 KB Output is correct
2 Correct 158 ms 1528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 367 ms 1528 KB Output is correct
2 Correct 295 ms 1528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 333 ms 1784 KB Output is correct
2 Correct 173 ms 1784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 458 ms 1828 KB Output is correct
2 Correct 370 ms 1888 KB Output is correct