ICPC Miền Trung 2026-2027 - Bài C: Rain in Hue
Đề bài
C. Rain in Hue
Standard I/O | Time Limit: 1s | Memory Limit: 256 MB
(Python on oj.vietnamson.com: 2s)
The rainy season in Hue lasts for months, so the festival committee reads the gauge at the observatory every single day.
The observatory recorded the rainfall of $n$ consecutive days. On day $i$ it measured $a_i$ millimetres.
The committee calls day $i$ a postponed day when the rainfall of that day is at least $m$ millimetres. A day that measured exactly $m$ millimetres is therefore a postponed day as well.
Report how many postponed days there were, and the total rainfall measured on those days alone.
Input
The first line contains two integers $n$ and $m$ $(1 \le n \le 1000, 0 \le m \le 1000)$ – the number of days and the threshold.
The second line contains $n$ integers $a_1, a_2, \dots, a_n$ $(0 \le a_i \le 1000)$ – the rainfall of each day in order.
Output
Print two integers separated by one space: the number of postponed days, and the total rainfall of the postponed days. If there is no postponed day, print 0 0.
Explanation of the Samples
- In the first sample, day 2 measured 30 millimetres and day 4 measured 45 millimetres. Both are at least 30, so there are two postponed days and their total rainfall is $30 + 45 = 75$. Day 2 measured exactly 30 millimetres and still counts.
- In the second sample, no day reached 100 millimetres, so there is no postponed day and both numbers are zero.
Note (VIETNAMSON)
- Problem of The ICPC 2026 - Vietnam Central Provincial Contest (Hue University of Sciences). The statement and samples are kept verbatim from the original PDF.
- In the original PDF both samples are printed in one table; here they are two separate samples.
- Python on oj.vietnamson.com: time limit 2 s, memory limit 1 GB.
Input
5 30
12 30 7 45 29
Output
2 75Input
3 100
99 1 0
Output
0 0Ý tưởng và lời giải chi tiết
Phần phân tích ý tưởng, các cách giải từ cơ bản đến tối ưu kèm code C++/Python và chấm thử trên VIETNAMSON OJ dành cho học viên đã đăng ký gói.
- Không biết học gì trước, học gì sau, học lan man nên kiến thức bị hổng.
- Bí bài không ai gỡ, ngồi cả buổi vẫn không ra rồi bỏ cuộc.
- Code chạy được nhưng không đủ điểm, không biết sai ở đâu, chậm ở đâu.
- Không có đề thi thử và người chấm, nên không biết mình đang ở mức nào.
- Dễ nản giữa chừng khi không có ai theo sát.
- Lộ trình 111 buổi video sắp sẵn từ dòng code đầu tiên đến đề HSG thật của các tỉnh.
- Thầy trực tiếp gỡ bí, chữa bài cho từng em qua nhóm Zalo riêng.
- Hệ thống chấm bài tự động 24/7 và thi thử HSG hằng tuần để biết chính xác mình đang ở đâu.
- Đóng học phí một lần, thầy kèm lâu dài: từ thi chuyên Tin đến HSG quốc gia và cả khi lên đại học.
