编译出来的exe太大怎么办
  • 板块灌水区
  • 楼主gzxworld
  • 当前回复10
  • 已保存回复10
  • 发布时间2024/8/18 09:01
  • 上次更新2024/8/18 11:44:20
查看原帖
编译出来的exe太大怎么办
706798
gzxworld楼主2024/8/18 09:01

#include <bits/stdc++.h>

using namespace std;

string S;

string T;

#define int long long int

const int MAXN = 1e6 + 10;

const int base1 = 1331, base2 = 131;

const int mod1 = 688890123359, mod2 = 6890328751;

int t1[MAXN] = {1, 1}, t2[MAXN] = {1, 1};

int hs1_S[MAXN], hs2_S[MAXN];

int hs1_T, hs2_T;

int stk[MAXN], top = 0;

signed main()
{
    ios :: sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> S >> T;
    S = ' ' + S;
    T = ' ' + T;
    for (int i = 1 ; i <= S.size() ; i ++)
    {
        t1[i] = t1[i - 1] * base1;
        t1[i] %= mod1;

        t2[i] = t2[i - 1] * base2;
        t2[i] %= mod2;
    }
    for (int i = 1 ; i < T.size() ; i ++)
    {
        hs1_T = hs1_T * base1 + T[i];
        hs1_T %= mod1;

        hs2_T = hs2_T * base2 + T[i];
        hs2_T %= mod2;
    }
    for (int i = 1 ; i < S.size() ; i ++)
    {
        stk[++ top] = S[i];
        hs1_S[top] = hs1_S[top - 1] * base1 + S[i];
        hs1_S[top] %= mod1;

        hs2_S[top] = hs2_S[top - 1] * base2 + S[i];
        hs2_S[top] %= mod2;
        int hs1_top = (hs1_S[top] - (hs1_S[top - (T.size() - 1)] * (__int128)t1[T.size() - 1]) % mod1 + mod1) % mod1;
        int hs2_top = (hs2_S[top] - (hs2_S[top - (T.size() - 1)] * (__int128)t2[T.size() - 1]) % mod2 + mod2) % mod2;
        if(hs1_top == hs1_T and hs2_top == hs2_T)
        {
            top -= (T.size() - 1);
        }
    }
    for (int i = 1 ; i <= top ; i ++)
    {
        cout << (char)stk[i];
    }
    return 0;
}

这坨shi编译出来16MB,学校OJ说

Your source code compiled to 16026152 bytes which is too big, too thick, too long for us.

然后不要我的代码直接CE了。。。

2024/8/18 09:01
加载中...