Submission #72340000


Source Code Expand

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    // 1. 读取输入的马匹数量N
    int N;
    cin >> N;
    
    // 2. 定义一个pair数组,first存用时,second存马匹编号(1-based)
    vector<pair<int, int>> horses;
    for (int i = 0; i < N; ++i) {
        int time;
        cin >> time;
        // 马匹编号是i+1(因为输入是从T1到TN)
        horses.emplace_back(time, i + 1);
    }
    
    // 3. 按用时升序排序(用时越短排名越前)
    sort(horses.begin(), horses.end());
    
    // 4. 输出前3名的马匹编号
    cout << horses[0].second << " " 
         << horses[1].second << " " 
         << horses[2].second << endl;
    
    return 0;
}

Submission Info

Submission Time
Task B - Trifecta
User stone_shadow
Language C++23 (GCC 15.2.0)
Score 200
Code Size 780 Byte
Status AC
Exec Time 1 ms
Memory 3584 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_01.txt AC 1 ms 3524 KiB
random_02.txt AC 1 ms 3492 KiB
random_03.txt AC 1 ms 3584 KiB
random_04.txt AC 1 ms 3492 KiB
random_05.txt AC 1 ms 3584 KiB
random_06.txt AC 1 ms 3540 KiB
random_07.txt AC 1 ms 3564 KiB
random_08.txt AC 1 ms 3456 KiB
sample_01.txt AC 1 ms 3408 KiB
sample_02.txt AC 1 ms 3584 KiB