jatarc2004

Untitled

Apr 13th, 2025
137
0
Never
7
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.68 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define int long long
  3. using namespace std;
  4. const int INF=1e18;
  5. const int MOD=998244353;
  6. vector<int> v[100005], pxor(100005,-1);
  7. void dfs(int x, string &s){
  8.     for(auto it:v[x]){
  9.         if(pxor[it]!=-1) continue;
  10.         pxor[it]=pxor[x]^(1<<(s[it]-'a'));
  11.         dfs(it,s);
  12.     }
  13. }
  14. int re(int x, vector<char>&r, string &s, int flag, vector<vector<int>>&dp){
  15.     if(x==s.size()) return 1;
  16.     if(dp[x][flag]!=-1) return dp[x][flag];
  17.     if(flag==0){
  18.         int ans=0;
  19.         for(int i=0; i<r.size(); i++){
  20.             ans+=re(x+1,r,s,flag,dp);
  21.             ans%=MOD;
  22.         }
  23.         return dp[x][flag]=ans;
  24.     }
  25.     else{
  26.         int ans=0;
  27.         for(int i=0; i<r.size(); i++){
  28.             if(r[i]<s[x]) ans+=re(x+1,r,s,0,dp);
  29.             else if(r[i]==s[x]) ans+=re(x+1,r,s,1,dp);
  30.             else break;
  31.             ans%=MOD;
  32.         }
  33.         return dp[x][flag]=ans;
  34.     }
  35. }
  36. signed main(){
  37.     ios_base::sync_with_stdio(false);
  38.     cin.tie(NULL);
  39.     int n;
  40.     cin>>n;
  41.     string s;
  42.     cin>>s;
  43.     s='#'+s;
  44.     for(int i=0; i<n-1; i++){
  45.         int a, b;
  46.         cin>>a>>b;
  47.         v[a].push_back(b);
  48.         v[b].push_back(a);
  49.     }
  50.     pxor[1]=(1<<(s[1]-'a'));
  51.     dfs(1,s);
  52.     int q;
  53.     cin>>q;
  54.     while(q--){
  55.         string a, b;
  56.         int x, y;
  57.         cin>>a>>b>>x>>y;
  58.         int rf=pxor[x]^pxor[y];
  59.         vector<char> vip;
  60.         for(int i=0; i<26; i++) if((rf>>i)&1) vip.push_back(('a'+i));
  61.         if(vip.size()==0){
  62.             cout<<0<<'\n';
  63.             continue;
  64.         }
  65.         vector<vector<int>> dp(a.length()+1,vector<int>(2,-1)), dp2(b.length()+1,vector<int>(2,-1));
  66.         int ans=re(0,vip,b,1,dp);
  67.         int ans2=re(0,vip,a,1,dp2);
  68.         int fin=((ans-ans2)%MOD+MOD)%MOD;
  69.         set<char> ne;
  70.         for(auto it:vip) ne.insert(it);
  71.         bool is=true;
  72.         for(auto it:b) if(ne.find(it)==ne.end()) is=false;
  73.         if(is) fin--;
  74.         fin%=MOD;
  75.         fin+=MOD;
  76.         fin%=MOD;
  77.         cout<<fin<<'\n';
  78.     }
  79. }
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Lenfilir
    48 days
    # CSS 0.85 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
  • User was banned
Add Comment
Please, Sign In to add comment