98132024-03-07 09:47:09Error42Tavaszi Karneválcpp17Elfogadva 100/100129ms15920 KiB
// tavaszi_karneval.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <map>

using namespace std;
using ll = long long;

const ll mod = 1000000007;

int main()
{
    ll size, hats;
    cin >> size >> hats;
    map<ll, ll> m;
    m[0] = hats;
    ll ans = 1;
    for (ll i = 0; i < size; i++)
    {
        ll next;
        cin >> next;
        ans *= m[next];
        ans %= mod;
        m[next]--;
        m[next + 1]++;
    }
    cout << ans << "\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
RészfeladatÖsszpontTesztVerdiktIdőMemória
subtask10/0
1Elfogadva3ms1812 KiB
2Elfogadva3ms2056 KiB
subtask210/10
3Elfogadva3ms2252 KiB
4Elfogadva3ms2340 KiB
5Elfogadva3ms2316 KiB
6Elfogadva3ms2556 KiB
subtask330/30
7Elfogadva3ms2668 KiB
8Elfogadva3ms2896 KiB
9Elfogadva3ms3152 KiB
10Elfogadva3ms3244 KiB
11Elfogadva3ms3328 KiB
12Elfogadva3ms3396 KiB
subtask460/60
13Elfogadva54ms6216 KiB
14Elfogadva21ms5196 KiB
15Elfogadva125ms8044 KiB
16Elfogadva105ms8596 KiB
17Elfogadva74ms8404 KiB
18Elfogadva125ms10928 KiB
19Elfogadva128ms11692 KiB
20Elfogadva128ms12768 KiB
21Elfogadva101ms13076 KiB
22Elfogadva105ms13964 KiB
23Elfogadva125ms14908 KiB
24Elfogadva129ms15920 KiB