53812023-04-27 18:48:04botondliskaSzínes szobák (50 pont)cpp17Time limit exceeded 10/50400ms6320 KiB
#include <iostream>
#define MAXN 100000

using namespace std;

typedef struct{
    int szin;
    int lepes;
}valami;
int n,k,m;
int szoba[MAXN];
int fo[MAXN];
valami muvelet[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>>muvelet[i].szin>>muvelet[i].lepes;

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

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


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/03ms1892 KiB
2Time limit exceeded0/0365ms3796 KiB
3Accepted1/14ms2308 KiB
4Accepted1/14ms2440 KiB
5Accepted1/14ms2524 KiB
6Accepted1/14ms2884 KiB
7Accepted1/14ms2956 KiB
8Accepted1/14ms3160 KiB
9Accepted1/14ms3236 KiB
10Accepted1/110ms3408 KiB
11Wrong answer0/14ms3632 KiB
12Accepted1/114ms3796 KiB
13Wrong answer0/1217ms3880 KiB
14Accepted1/176ms4032 KiB
15Wrong answer0/193ms4004 KiB
16Time limit exceeded0/1365ms3356 KiB
17Time limit exceeded0/1363ms3432 KiB
18Time limit exceeded0/1328ms3396 KiB
19Time limit exceeded0/1379ms4444 KiB
20Wrong answer0/1151ms6104 KiB
21Time limit exceeded0/1358ms4476 KiB
22Time limit exceeded0/1307ms5892 KiB
23Time limit exceeded0/1370ms4568 KiB
24Wrong answer0/1270ms6264 KiB
25Time limit exceeded0/1379ms4588 KiB
26Time limit exceeded0/1375ms4608 KiB
27Time limit exceeded0/3347ms4732 KiB
28Wrong answer0/328ms6320 KiB
29Wrong answer0/328ms6252 KiB
30Wrong answer0/328ms6248 KiB
31Time limit exceeded0/3400ms5240 KiB
32Time limit exceeded0/3335ms5076 KiB
33Time limit exceeded0/4384ms4896 KiB
34Time limit exceeded0/4368ms5132 KiB