98132024-03-07 09:47:09Error42Tavaszi Karneválcpp17Accepted 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
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1812 KiB
2Accepted3ms2056 KiB
subtask210/10
3Accepted3ms2252 KiB
4Accepted3ms2340 KiB
5Accepted3ms2316 KiB
6Accepted3ms2556 KiB
subtask330/30
7Accepted3ms2668 KiB
8Accepted3ms2896 KiB
9Accepted3ms3152 KiB
10Accepted3ms3244 KiB
11Accepted3ms3328 KiB
12Accepted3ms3396 KiB
subtask460/60
13Accepted54ms6216 KiB
14Accepted21ms5196 KiB
15Accepted125ms8044 KiB
16Accepted105ms8596 KiB
17Accepted74ms8404 KiB
18Accepted125ms10928 KiB
19Accepted128ms11692 KiB
20Accepted128ms12768 KiB
21Accepted101ms13076 KiB
22Accepted105ms13964 KiB
23Accepted125ms14908 KiB
24Accepted129ms15920 KiB