QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#275586#5311. Master of Bothchitoge#Compile Error//C++201.2kb2023-12-04 21:10:212023-12-04 21:10:21

Judging History

你现在查看的是最新测评结果

  • [2023-12-04 21:10:21]
  • 评测
  • [2023-12-04 21:10:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

vector<pair<int,int>> pex[1000005];

#define endl '\n'

int rex[30][30];

set<pair<int,int> > vis;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,q;cin>>n>>q;
    string s;
    int maxlen=0;
    for(int i=0;i<n;i++){
        cin>>s;
        for(int j=0;j<s.size();j++){
            pex[j].push_back(make_pair(s[j]-'a',i));
        }
        maxlen=max(maxlen,(int)s.size());
    }

    for(int i=0;i<maxlen;i++){
        for(int j=1;j<pex[i].size();j++){
            for(int k=0;k<j;k++){
                if(vis.count(make_pair(pex[i][j].second,pex[i][k].second)))continue;
                if(pex[i][j].first!=pex[i][k].first){
                    rex[pex[i][j].first][pex[i][k].first]++;
                    vis.insert(make_pair(pex[i][j].second,pex[i][k].second));
                }
            }
        }
    }

    for(int i=0;i<q;i++){
        string s;
        cin>>s;
        long long ans=0;
        for(int l=0;l<26;l++){
            for(int r=l+1;r<26;r++){
                ans+=rex[s[l]-'a'][s[r]-'a'];
            }
        }
        cout<<ans<<endl;
    }

    return 0;

詳細信息

answer.code: In function ‘int main()’:
answer.code:50:14: error: expected ‘}’ at end of input
   50 |     return 0;
      |              ^
answer.code:12:11: note: to match this ‘{’
   12 | int main(){
      |           ^