Submission #875822

# Submission time Handle Problem Language Result Execution time Memory
875822 2023-11-20T14:47:25 Z resfast Selling RNA Strands (JOI16_selling_rna) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define islam_zymchybekov void solve()
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define endl '\n'
#define nl cout<<'\n';
#define int long long
#define stg string
#define yes cout<<"Yes\n";
#define no cout<<"No\n";
typedef vector<int> vi;
typedef pair<int,int> pi;
int c,n,m,i,j,k,x,y,cnt=0,res=0,l=0,mx=-1,sum=0,nx=-1;
islam_zymchybekov{
    string s, s1;
    cin >> n >> m;
    unordered_map<string, int> mp;

    for (int i = 0; i < n; i++) {
        cin >> s;
        mp[s]++;
    }

    for (int i = 0; i < m; i++) {
        cin >> s >> s1;
        int ans = 0;
        int len_s = s.size();
        int len_s1 = s1.size();

        for (auto &it : mp) {
            string curr = it.first;
            int len_curr = curr.size();
            
            if (len_curr >= max(len_s, len_s1)) {
                if (curr.substr(0, len_s) == s && curr.substr(len_curr - len_s1) == s1) {
                    ans += it.second;
                }
            }
        }
        cout << ans; nl;
    }
}

int main(){
    int T = 1;
    while(T--){
        solve();
    }
    return 0;
}

Compilation message

cc1plus: error: '::main' must return 'int'