๐ Day 10 โ Teacher's Day Challenge | Next Round Qualification


๐๏ธ Date: August 03, 2025
๐งฉ Platform: Codeforces
๐ข Problems Solved Today: 1
๐ฏ Focus Topic: Arrays, Conditional Logic, Ranking System
๐ Table of Contents
Daily Summary
๐งฉ Problem 1 โ Next Round
๐ Difficulty: Easy
๐ง Concepts: Array Traversal, Indexing, Score Threshold
๐ Problem Statement (Summary):
You are given the scores of n
participants in non-increasing order and an integer k
.
A participant advances to the next round if:
Their score is โฅ score of the k-th participant, and
Their score is greater than 0.
Count how many participants will advance.
๐ Example:
Input:
8 5
10 9 8 7 7 7 5 5
Output:
6
๐ก Approach:
Input
n
andk
, and storen
scores in a vector.The score of the
k-th
participant isnums[k-1]
.Traverse all scores:
- If current score โฅ
nums[k-1]
and > 0, count it.
- If current score โฅ
Print the final count.
๐งช Code (C++):
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, k, c = 0;
cin >> n >> k;
vector<int> nums(n);
for (int i = 0; i < nums.size(); i++)
cin >> nums[i];
for (int i = 0; i < n; i++) {
if (nums[i] >= nums[k - 1] && nums[i] > 0)
c++;
}
cout << c;
return 0;
}
๐ธ Submission Screenshot:
(Attach your accepted screenshot here using โ image in editor)
โ Key Takeaways:
Carefully access the k-th element using
k-1
index (0-based indexing).Ensure the score is positive before counting.
The non-increasing order guarantees we can compare directly from the front.
Clean array traversal with simple conditions is key.
๐ Daily Summary
Metric | Value |
Problems Solved | 1 |
Topics Covered | Arrays, Ranking Logic |
Tools Used | C++ |
Next Focus | Prefix Sum, Basic Sorting |
Day | 10 / 30 |
๐ท๏ธ Tags:#codeforces #arrays #ranking #contestlogic #cpp #dsa #43DaysChallenge
Subscribe to my newsletter
Read articles from Tanishi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
