Contest #1
Difference between en1 and en2, changed 253 character(s)
## A. Still Typing↵
↵
<spoiler summary="Hint 1 (English)">↵
Store the 10 names in a fixed array in the exact same order given in the problem statement.↵
</spoiler>↵
↵
<spoiler summary="Hint 2 (English)">↵
Find the index $i$ ($0 \le i < 10$) that has the maximum typing speed, then print the name at index $i$.↵
</spoiler>↵
↵
<spoiler summary="Editorial (English)">↵
We are given the names of $10$ participants in a fixed order, followed by $10$ integers representing their typing speeds.↵
↵
1. Store the names in an array of strings `names` of size $10$ matching the order in the statement.↵
2. Read the $10$ speeds into an array `arr` (or process them on the fly).↵
3. Track the maximum speed `mx` found so far and its corresponding index `idx`.↵
4. Finally, output `names[idx]`.↵
↵
* **Time Complexity:** $\mathcal{O}(1)$ (since the number of participants is fixed at $10$).↵
* **Space Complexity:** $\mathcal{O}(1)$.↵
</spoiler>↵
↵
---↵
↵
<spoiler summary="تلميح 1 (عربي)">↵
خزّن أسماء الـ 10 متسابقين في Array ثابتة بنفس الترتيب المذكور في نص المسألة بالظبط.↵
</spoiler>↵
↵
<spoiler summary="تلميح 2 (عربي)">↵
دوّر على الـ Index صاحب أكبر سرعة كتابة، وبعدين اطبع الاسم الموجود في نفس الـ Index.↵
</spoiler>↵
↵
<spoiler summary="الشرح (عربي)">↵
المسألة بتدينا أسماء $10$ متسابقين بترتيب ثابت، وبعدها بتدينا $10$ أرقام بيمثلوا سرعة كل واحد فيهم بالترتيب.↵
↵
1. هنعمل Array من نوع `string` نحط فيها الأسماء بنفس الترتيب المكتوب في المسألة.↵
2. هنستقبل الـ $10$ أرقام ونعدي عليهم بـ Loop عشان نجيب أكبر رقم (`mx`) ونحتفظ بمكانه (`idx`).↵
3. في الآخر هنطبع الاسم اللي في المكان ده `names[idx]`.↵
↵
* **التعقيد الزمني (Time Complexity):** $\mathcal{O}(1)$ لأن عدد العناصر ثابت وهو $10$.↵
* **مساحة الذاكرة (Space Complexity):** $\mathcal{O}(1)$.↵
</spoiler>↵
↵
<spoiler summary="Solution Code (C++)">↵
```cpp↵
#include <bits/stdc++.h>↵
using namespace std;↵
↵
#define int long long↵
#define endl "\n"↵
↵
signed main() {↵
    ios_base::sync_with_stdio(false);↵
    cin.tie(nullptr);↵
↵
 
   // Store participant names in the exact given order↵
    string 
names[] = ans[]={"Andrew", "Moaz", "Hani", "Dabour", "Seif", ↵
                      
"Omar", "Hadeer", "Mariam", "Mai", "Basant"};↵
    ↵
 
   int arr[10];↵
   
 for (int i = 0; i < =0;i<10; i++) {↵
        
cin >> arr[i];↵
    }↵
↵
    int mx = =0;↵
    int idx
 = =-1;↵
↵
    // Find the index of the maximum typing speed↵
  
  for (int i = 0; i < =0;i<10; i++) {↵
        if (arr[i] > >mx) {↵
            mx = =arr[i];↵
            idx = =i;↵
        }↵
    }↵
↵
  
  cout << nameans[idx] << endl;↵
    return 0;↵
}↵
[cut]

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English AndrewHazem 2026-11-27 02:03:16 1246
en2 English AndrewHazem 2026-11-27 02:01:47 253
en1 English AndrewHazem 2026-11-27 01:58:50 2557 Initial revision (published)