53832023-04-27 19:03:37botondliskaSzínes szobák (50 pont)cpp17Time limit exceeded 10/50379ms5452 KiB
#include <iostream>
#define MAXN 100000

using namespace std;

int n,k,m;
int szoba[MAXN];
int fo[MAXN];
int szin[MAXN];
int lepes[MAXN];

int main()
{
cin>>n>>k>>m;

for(int i=1;i<n+1;++i)fo[i]=1;
for(int i=1;i<n+1;++i)cin>>szoba[i];
for(int i=0;i<m;++i)cin>>szin[i]>>lepes[i];

for(int i=0;i<m;++i)
{
    for(int j=1;j<n+1;++j)
    {
        if(szin[i]==szoba[j])
        {
            if(lepes[i]==1)fo[j+1]+=fo[j];
            if(lepes[i]==-1)fo[j-1]+=fo[j];
            fo[j]=0;
        }
    }
}

cout<<fo[0]+fo[n+1];


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/03ms2044 KiB
2Time limit exceeded0/0365ms3788 KiB
3Accepted1/14ms2460 KiB
4Accepted1/14ms2564 KiB
5Accepted1/14ms2752 KiB
6Accepted1/14ms3080 KiB
7Accepted1/14ms2912 KiB
8Accepted1/14ms2916 KiB
9Accepted1/14ms3172 KiB
10Accepted1/110ms3276 KiB
11Wrong answer0/14ms3300 KiB
12Accepted1/114ms3320 KiB
13Wrong answer0/1215ms3532 KiB
14Accepted1/175ms3464 KiB
15Wrong answer0/193ms3508 KiB
16Time limit exceeded0/1363ms3932 KiB
17Time limit exceeded0/1351ms2968 KiB
18Time limit exceeded0/1351ms3340 KiB
19Time limit exceeded0/1368ms3900 KiB
20Wrong answer0/1151ms5436 KiB
21Time limit exceeded0/1361ms3660 KiB
22Time limit exceeded0/1307ms5264 KiB
23Time limit exceeded0/1368ms3636 KiB
24Wrong answer0/1270ms5256 KiB
25Time limit exceeded0/1370ms3800 KiB
26Time limit exceeded0/1344ms3688 KiB
27Time limit exceeded0/3372ms3720 KiB
28Wrong answer0/328ms5308 KiB
29Wrong answer0/328ms5440 KiB
30Wrong answer0/328ms5452 KiB
31Time limit exceeded0/3354ms4444 KiB
32Time limit exceeded0/3360ms4316 KiB
33Time limit exceeded0/4379ms4184 KiB
34Time limit exceeded0/4375ms4728 KiB