CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 17:41:15 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=f3f564f7d33018fb4905bc14189cb827f0edddc2827b2217c1ac93226f4bd44fa%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22ug4xkrcSifieMkJMdNTenU1L0gsjXA2d%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d025b12c185917-BLR
Медианчо - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- #include <unordered_map>
- using namespace std;
- int main()
- {
- int n,b;
- cin >> n >>b;
- vector<int>nums(n+1);
- int whereM=-1;
- for(int i=1; i<=n; i++)
- {
- int x;
- cin>>x;
- if(x==b)
- {
- whereM=i;
- }
- nums[i]=x;
- }
- int sum=0;
- unordered_map<int,int> odd;
- unordered_map<int,int> even;
- even[0]=1;
- odd[0]=0;
- for(int i=whereM-1; i>0; i--)
- {
- if(nums[i]>b)sum++;
- else sum--;
- if((whereM-i)%2==0)
- {
- if(even.find(sum)!=even.end())even[sum]++;
- else even[sum]=1;
- }
- else if(odd.find(sum)!=odd.end())odd[sum]++;
- else odd[sum]=1;
- }
- sum=0;
- int count=even[0];
- for(int i=whereM+1; i<=n ; i++)
- {
- if(nums[i]>b)sum++;
- else sum--;
- if((i-whereM)%2==0)
- {
- if(even.find(-sum)!=even.end()) count +=even[-sum];
- }
- else
- {
- if(odd.find(-sum)!=odd.end()) count+=odd[-sum];
- }
- }
- cout << count<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐⭐⭐Exchange Exploit T 3⭐⭐
Java | 7 sec ago | 0.10 KB
-
⭐✅ Trading Profit Method ✅ NEVER SEEN BEFORE...
JavaScript | 10 sec ago | 0.24 KB
-
⭐⭐⭐Make $1500 in 20 minutes⭐⭐
Java | 18 sec ago | 0.10 KB
-
⭐ Instant BTC Profit Method ✅ NEVER SEEN BEFO...
JavaScript | 20 sec ago | 0.24 KB
-
⭐✅ MAKE $2000 INSTANTLY ✅ NEVER SEEN BEFORE ⭐...
JavaScript | 29 sec ago | 0.24 KB
-
⭐ Free Crypto Method ✅ NEVER SEEN BEFORE ⭐⭐⭐
JavaScript | 39 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ✅ NEVER SEEN...
JavaScript | 48 sec ago | 0.24 KB
-
⭐⭐⭐Profit Method⭐⭐
Java | 49 sec ago | 0.10 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand