Guest User

c.cpp

a guest
Nov 19th, 2025
43
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.37 KB | None | 0 0
  1. #pragma comment(linker, "/stack:2000000")
  2. #pragma GCC optimize("Ofast")
  3. #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
  4.  
  5. #include <bits/stdc++.h>
  6.  
  7. #define mp make_pair
  8. #define pb push_back
  9. #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  10. #define ll long long
  11. #define f first
  12. #define s second
  13.  
  14. using namespace std;
  15. int n, m, k, a[1000000];
  16. const int INF = (int)(1e9 + 7);
  17. const int MAXN = (int)(5e5 + 7);
  18. set <int> sta[2100000], sta2[2100000];
  19. int t[MAXN * 4], t3[MAXN * 4], t2[MAXN * 4], dp[MAXN * 4];
  20. pair <int, pair <int, int> > mas[MAXN];
  21.  
  22. void build (int v, int tl, int tr) {
  23.     if (tl == tr){
  24.         if (sta[a[tl]].upper_bound(-tl) == sta[a[tl]].end())
  25.             t[v] = -INF;
  26.         else
  27.             t[v] = -(*sta[a[tl]].upper_bound(-tl));
  28.  
  29.         t2[v] = a[tl];
  30.         t3[v] = a[tl];
  31.     }
  32.     else {
  33.         int tm = (tl + tr) / 2;
  34.         build (v*2, tl, tm);
  35.         build (v*2+1, tm+1, tr);
  36.         t[v] = max(t[v*2], t[v*2+1]);
  37.         t2[v] = max(t2[v*2], t2[v*2+1]);
  38.         t3[v] = min(t3[v*2], t3[v*2+1]);
  39.     }
  40. }
  41.  
  42. int get_max2(int v, int tl, int tr, int l, int r) {
  43.     if (l > r)
  44.         return -INF;
  45.     if (l == tl && r == tr)
  46.         return t[v];
  47.     int tm = (tl + tr) / 2;
  48.     return max(get_max2 (v*2, tl, tm, l, min(r,tm)), get_max2 (v*2+1, tm+1, tr, max(l,tm+1), r));
  49. }
  50.  
  51. int get_max(int v, int tl, int tr, int l, int r) {
  52.     if (l > r)
  53.         return -INF;
  54.     if (l == tl && r == tr)
  55.         return t2[v];
  56.     int tm = (tl + tr) / 2;
  57.     return max(get_max (v*2, tl, tm, l, min(r,tm)), get_max (v*2+1, tm+1, tr, max(l,tm+1), r));
  58. }
  59.  
  60. int get_min(int v, int tl, int tr, int l, int r) {
  61.     if (l > r)
  62.         return INF;
  63.     if (l == tl && r == tr)
  64.         return t3[v];
  65.     int tm = (tl + tr) / 2;
  66.     return min(get_min (v*2, tl, tm, l, min(r,tm)), get_min (v*2+1, tm+1, tr, max(l,tm+1), r));
  67. }
  68.  
  69. void update (int v, int tl, int tr, int pos) {
  70.     if (tl == tr){
  71.         if (sta[a[tl]].upper_bound(-tl) == sta[a[tl]].end())
  72.             t[v] = -INF;
  73.         else
  74.             t[v] = -(*sta[a[tl]].upper_bound(-tl));
  75.  
  76.         t2[v] = a[tl];
  77.         t3[v] = a[tl];
  78.     }
  79.     else {
  80.         int tm = (tl + tr) / 2;
  81.         if (pos <= tm)
  82.             update (v*2, tl, tm, pos);
  83.         else
  84.             update (v*2+1, tm+1, tr, pos);
  85.         t[v] = max(t[v*2], t[v*2+1]);
  86.         t2[v] = max(t2[v*2], t2[v*2+1]);
  87.         t3[v] = min(t3[v*2], t3[v*2+1]);
  88.     }
  89. }
  90. map <int, int> ma;
  91. int main() {
  92.     IOS;
  93.     int n;
  94.     cin >> n;
  95.     vector <int> vec;
  96.     for (int i = 1; i <= n; i++){
  97.         cin >> a[i];
  98.         vec.pb(a[i]);
  99.     }
  100.     int q;
  101.     cin >> q;
  102.     for (int i = 1; i <= q; i++){
  103.         cin >> mas[i].f >> mas[i].s.f >> mas[i].s.s;
  104.         if (mas[i].f == 1){
  105.             vec.pb(mas[i].s.s);
  106.         }
  107.     }
  108.     sort(vec.begin(), vec.end());
  109.     ma[vec[0]] = 1;
  110.     int it = 1;
  111.     for (int i = 1; i < vec.size(); i++)
  112.         if (vec[i] - vec[i - 1] == 1)
  113.         {
  114.             it++;
  115.             ma[vec[i]] = it;
  116.         }
  117.         else if (vec[i] - vec[i - 1] > 1){
  118.             it += 2;
  119.             ma[vec[i]] = it;
  120.         }
  121.  
  122.     for (int i = 1; i <= n; i++)
  123.         a[i] = ma[a[i]];
  124.  
  125.     for (int i = 1; i <= n; i++){
  126.         sta[a[i]].insert(-i);
  127.         sta2[a[i]].insert(i);
  128.     }
  129.     build(1, 1, n);
  130.     for (int i = 1; i <= q; i++)
  131.     {
  132.         int type;
  133.         type = mas[i].f;
  134.         if (type == 1){
  135.  
  136.             int pos, val;
  137.             pos = mas[i].s.f;
  138.             val = ma[mas[i].s.s];
  139.             sta[a[pos]].erase(-pos);
  140.             sta2[a[pos]].erase(pos);
  141.             int gg = a[pos];
  142.             a[pos] = val;
  143.             sta[val].insert(-pos);
  144.             sta2[val].insert(pos);
  145.             update(1, 1, n, pos);
  146.             if (sta2[gg].upper_bound(pos) != sta2[gg].end())
  147.                 update(1, 1, n, *sta2[gg].upper_bound(pos));
  148.  
  149.             if (sta2[val].upper_bound(pos) != sta2[val].end())
  150.                 update(1, 1, n, *sta2[val].upper_bound(pos));
  151.         }
  152.         else{
  153.             int l, r;
  154.             l = mas[i].s.f;
  155.             r = mas[i].s.s;
  156.             int l1 = get_min(1, 1, n, l, r);
  157.             int r1 = get_max(1, 1, n, l, r);
  158.             int z = get_max2(1, 1, n, l, r);
  159.             //cout << "~~~!! " << z << ' ' << l1 << ' ' << r1 << endl;
  160.             if (z < l && r1 - l1 == r - l)
  161.                 cout << "YES\n";
  162.             else
  163.                 cout << "NO\n";
  164.         }
  165.     }
  166.     return 0;
  167. }
  168. /*
  169.  
  170. 5
  171. 1 3 2 5 4
  172. 8
  173. 2 1 3
  174. 2 1 4
  175. 2 1 5
  176. 1 4 4
  177. 2 1 4
  178. 2 2 5
  179. 1 4 5
  180. 2 2 5
  181. */
Advertisement
Comments
  • Jaxnetir
    3 days
    # CSS 0.84 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1ifNm-s74mX7GChaEzSJ1dVQCy1SrSxlMVRYi8ys0rgQ/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).
Add Comment
Please, Sign In to add comment