88662024-02-02 17:01:55dvd09292Színes szobák (50 pont)cpp17Time limit exceeded 10/50400ms17152 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

#define ll  long long
#define vll  vector<long long>
#define pll pair<long long, long long>
#define fs first
#define sc second

void mozg(ll c, int x, vector<pll> v)
{
    cout<<"===="<<endl<<c<<"|"<<x<<":";
    for(ll o=1; o < v.size()-1;o++)
    {
        cout<<" -";
        if(v[o].fs==c && v[o].sc>0)
        {
            v[o].sc--;
            v[o+x].sc++;
            cout<<"ye";
        }
        cout<<endl;
    }
}

int main() {
    ll n, k, m; cin >> n >> k >> m;
    pll a{0,1};
    vector<pll> v(n+2,a);
    v[0].sc=0;
    v[0].fs=-1;
    v[n+1].sc=0;
    v[n+1].fs=-1;

    //fs:színe, sc:emberek száma
    for(ll i=1; i<n+1; i++)
    {
        cin >> v[i].fs;
    }

    /*for(ll i=0; i<n+2; i++)
    {
        cout << v[i].fs << " ";
    }
    cout<<endl;
    for(ll i=0; i<n+2; i++)
    {
        cout << v[i].sc << " ";
    }
    cout<<endl;*/

    ll c = 0;
    int x = 0;
    for(ll j=0; j<m; j++)
    {
        cin >> c >> x;
        //mozg(c,x,v);
        //cout<<"===="<<endl<<c<<"|"<<x<<":";
        for(ll o=1; o < v.size()-1;o++)
        {
            //cout<<" -";
            if(v[o].fs==c && v[o].sc>0)
            {
                v[o+x].sc+=v[o].sc;
                v[o].sc=0;
                //cout<<"ye";
            }
            //cout<<endl;
        }


        /*for(ll i=0; i<n+2; i++)
        {
            cout << v[i].fs << " ";
        }
        cout<<endl;
        for(ll i=0; i<n+2; i++)
        {
            cout << v[i].sc << " ";
        }
        cout<<endl;*/
    }
    cout << v[0].sc+v[n+1].sc;

}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/03ms1812 KiB
2Time limit exceeded0/0400ms3460 KiB
3Accepted1/14ms2976 KiB
4Accepted1/14ms3212 KiB
5Accepted1/14ms3576 KiB
6Accepted1/14ms3836 KiB
7Accepted1/14ms3924 KiB
8Accepted1/14ms4020 KiB
9Accepted1/14ms4308 KiB
10Accepted1/110ms4564 KiB
11Wrong answer0/14ms4776 KiB
12Accepted1/110ms5032 KiB
13Wrong answer0/1164ms5200 KiB
14Accepted1/165ms5304 KiB
15Wrong answer0/182ms5540 KiB
16Time limit exceeded0/1321ms5804 KiB
17Time limit exceeded0/1358ms5032 KiB
18Time limit exceeded0/1358ms5132 KiB
19Time limit exceeded0/1384ms7304 KiB
20Time limit exceeded0/1358ms7924 KiB
21Time limit exceeded0/1365ms8724 KiB
22Time limit exceeded0/1400ms9496 KiB
23Time limit exceeded0/1326ms10348 KiB
24Time limit exceeded0/1358ms11176 KiB
25Time limit exceeded0/1372ms12148 KiB
26Time limit exceeded0/1370ms13060 KiB
27Time limit exceeded0/3370ms13652 KiB
28Time limit exceeded0/3365ms14312 KiB
29Time limit exceeded0/3368ms14892 KiB
30Time limit exceeded0/3354ms15480 KiB
31Time limit exceeded0/3374ms16204 KiB
32Time limit exceeded0/3365ms16984 KiB
33Time limit exceeded0/4354ms16692 KiB
34Time limit exceeded0/4381ms17152 KiB