101498C - Lunch Break

  • Get index of minimum element.

Time complexity: $O(1)$

Memory complexity: $O(1)$

Click to show code.


using namespace std;
int main(void)
{
    ios::sync_with_stdio(false), cin.tie(NULL);
    int t;
    cin >> t;
    string ans[3] = {"First", "Second", "Third"};
    int roads[3];
    while (t--)
    {
        cin >> roads[0] >> roads[1] >> roads[2];
        cout << ans[distance(roads, min_element(roads, roads + 3))] << endl;
    }
    return 0;
}