QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21245. فوق الوسيط

Statistics

صف Farmer John أبقاره الـ $N$ لقياس أطوالها، $1 \le N \le 100,000$. طول البقرة $i$ هو $H_{i}$ نانومتر، $1 \le H_{i} \le 1,000,000,000$ — يؤمن FJ بالدقة! يريد تصوير جزء متتالٍ منها لمسابقة تصوير الأبقار بمعرض المقاطعة.

للمعرض قاعدة غريبة لكل الصور: تقبل الصورة فقط إذا كان وسيط أطوال المجموعة لا يقل عن العتبة $X$، $1 \le X \le 1,000,000,000$.

نعرف وسيط المصفوفة $A[0...K]$ بأنه $A[\mathrm{ceiling}(K/2)]$ بعد ترتيب $A$. يقرب $\mathrm{ceiling}(K/2)$ الكمية $K/2$ للأعلى لأقرب صحيح (أو يبقي $K/2$ إذا كان $K/2$ صحيحًا أصلًا). مثلًا وسيط $\{7,3,2,6\}$ هو 6، ووسيط $\{5,4,8\}$ هو 5.

عد الأجزاء المتتالية المختلفة التي يمكن لـFJ تقديمها.

الإدخال

  • السطر 1: عددان صحيحان $N$ و$X$ بينهما مسافة.
  • الأسطر 2..$N$+1: السطر $i+1$ يحتوي الصحيح $H_{i}$.

الإخراج

  • السطر 1: عدد الأجزاء بوسيط لا يقل عن $X$. قد لا تتسع الإجابة في صحيح 32 بت.

أمثلة

الإدخال 1

4 6
10
5
6
2

الإخراج 1

7

ملاحظة

الأطوال الأربعة $10,5,6,2$. نريد الأجزاء المتتالية بوسيط لا يقل عن 6.

هناك 10 أجزاء ممكنة، منها 7 فقط بوسيط لا يقل عن 6: $\{10\}$، $\{6\}$، $\{10,5\}$، $\{5,6\}$، $\{6,2\}$، $\{10,5,6\}$، $\{10,5,6,2\}$.

مؤلف المسألة: Brian Dean

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.