Submission #1103026

# Submission time Handle Problem Language Result Execution time Memory
1103026 2024-10-19T12:00:52 Z FIFI_cpp Parametriziran (COCI19_parametriziran) C++17
110 / 110
246 ms 3404 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <fstream>
#include <iterator>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cctype>
#include <string>
#include <cassert>
#include <set>
#include <bitset>
#include <unordered_set>
#include <numeric>
using ll = int64_t;
#define pb push_back
#define all(a) a.begin(),a.end()
#define ppi pair<int,pair<int,int>>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//#define int int64_t
// xcode cant include bits/stdc++.h
using namespace std;
/*   /\_/\
*   (= ._.)
*   / >  \>
*/
// encouraging cat
//const int INF = 10000000000000000;
//const int mod = 1000000007;
const int mod = 998244353;
const int MAXN = 5e4 + 5;
//ifstream fin("electric.in");
//ofstream fout("electric.out");
bitset<MAXN> vis[6][26], a;
int32_t main() {
    int n,m;
    cin >> n >> m;
    vector<string> s(n);
    for (int i = 0;i < n;i++)
    {
        cin >> s[i];
    }
    for (int i = 0;i < n;i++)
    {
        for (int j = 0;j < m;j++)
        {
            if (s[i][j] == '?')
            {
                for (int k = 0;k < 26;k++)
                {
                    vis[j][k][i] = 1;
                }
                
            }
            else
            {
                vis[j][s[i][j] - 'a'][i] = 1;
            }
        }
    }
    int res = 0;
    for (int i = 0;i < n;i++)
        a[i] = 1;
    for (int i = 0;i < n;i++)
    {
        a[i] = false;
        bitset<MAXN> curr = a;
        for (int j = 0;j < m;j++)
        {
            if (s[i][j] != '?')
            {
                curr &= vis[j][s[i][j] - 'a'];
            }
        }
        res += curr.count();
    }
    cout << res << '\n';
    return 0;
}

Compilation message

parametriziran.cpp:31:9: warning: "/*" within comment [-Wcomment]
   31 | /*   /\_/\
      |
# Verdict Execution time Memory Grader output
1 Correct 114 ms 2132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 1620 KB Output is correct
2 Correct 73 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 2132 KB Output is correct
2 Correct 138 ms 2388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 108 ms 1820 KB Output is correct
2 Correct 86 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 153 ms 2644 KB Output is correct
2 Correct 69 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 192 ms 2644 KB Output is correct
2 Correct 112 ms 2388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 160 ms 2388 KB Output is correct
2 Correct 79 ms 2132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 185 ms 2596 KB Output is correct
2 Correct 158 ms 2980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 197 ms 2644 KB Output is correct
2 Correct 92 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 246 ms 3288 KB Output is correct
2 Correct 189 ms 3404 KB Output is correct