QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#747333#5311. Master of BothMoemi_Compile Error//C++201.9kb2024-11-14 16:54:432024-11-14 16:54:44

Judging History

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

  • [2024-11-14 16:54:44]
  • 评测
  • [2024-11-14 16:54:43]
  • 提交

answer

#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <stack>
#include <cstring>
#include <iomanip>
#include <unordered_map>
#include <numeric>

#define sc_int(x) scanf("%d", &x)

#define x first
#define y second
#define pb push_back

using namespace std;

const int N = 5e5 + 10, M = 26, MOD = 80112002;
const int inf = 1e9;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef pair<char, int> PCI;
typedef pair<string, string> PSS;

LL n, m;
LL idx;
LL son[N * M][M], cnt2[N * M], cnt[N * M];
LL f[M][M];

void add(string s)
{
    int cur = 0;
    int len = s.length();
    for(int i = 0; i < len; i ++)
    {
        if(!son[cur][s[i] - 'a']) son[cur][s[i] - 'a'] = ++ idx;
        for(int j = 0; j < 26; j ++) 
        {
            if(son[cur][j] && j != s[i] - 'a') 
                f[j][s[i] - 'a'] += cnt[son[cur][j]];
        }
        f[s[i] - 'a'][s[i] - 'a'] += cnt2[cur];
        cur = son[cur][s[i] - 'a'];
        cnt[cur] ++;
    }
    cnt2[cur] ++;
}

void solve() 
{
    cin >> n >> m;
    vector<string> vec(n);
    for(int i = 0; i < n; i ++)
    {
        cin >> vec[i];
    }

    for(auto t : vec) add(t);

    while(m -- )
    {
        LL ans = 0;
        string s;
        cin >> s;
        for(int i = 0; i < 26; i ++)
            for(int j = 0; j <= i; j ++)
            {
                ans += f[s[i] - 'a'][s[j] - 'a'];
            }
        cout << ans << endl;
    }
}

int main()
{
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    int T = 1;
    // cin >> T;
    while(T --)
    {
        solve();
    }
}

Details

/tmp/ccUeQBHG.o: in function `add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
answer.code:(.text+0x69): relocation truncated to fit: R_X86_64_PC32 against symbol `idx' defined in .bss section in /tmp/ccUeQBHG.o
answer.code:(.text+0x74): relocation truncated to fit: R_X86_64_PC32 against symbol `idx' defined in .bss section in /tmp/ccUeQBHG.o
/tmp/ccUeQBHG.o: in function `solve()':
answer.code:(.text+0x149): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUeQBHG.o
answer.code:(.text+0x178): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccUeQBHG.o
answer.code:(.text+0x187): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUeQBHG.o
answer.code:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUeQBHG.o
answer.code:(.text+0x206): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUeQBHG.o
answer.code:(.text+0x386): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccUeQBHG.o
answer.code:(.text+0x394): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccUeQBHG.o
answer.code:(.text+0x489): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccUeQBHG.o
answer.code:(.text+0x494): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status