UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#144161#10. 小x的城池loouwiit0538ms1268kbC++693b2021-12-12 15:16:242021-12-12 15:16:25

answer

#include <iostream>
using namespace std;
int n,Q,i=0,end,Map[100000],Danger;//nQ:数量 Map人口
bool Road[100000],Level[100000];//路的方向和等级;
int main()
{
	char P[10];
	cin>>n>>Q;
	for (i=0;i<n;i++)
	{
		cin>>Map[i]>>P;
		if (P[0]=='A'){Level[i]=true;}else{Level[i]=false;}
		Road[i]=true;
	}
	for (;Q>0;Q--)
	{
		cin>>P;
		if (P[0]=='U')
		{
			cin>>i;
			cin>>Map[i];
		}
		else
		{
			cin>>i>>end;
			while (i<end)
			{
				Road[i]=!Road[i];
				i++;
			}
		}
		//输出
		for (i=0,Danger=0;i<n;i++)
		{
			if (Level[i])
			{
				if(Map[Road[i]?1:-1]>Map[i])
				{
					Danger++;
				}
			}//B不判断
		}
		cout<<Danger<<endl;
	}
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1212kb

input:

7 5
0 A
32 B
10 B
27 B
25 A
30 B
10 A
UPDATE 1 1
UPDATE 6 22
UPDATE 1 50
UPDATE 6 62
UPDATE 5 67

output:

1
1
3
2
2

result:

wrong answer 1st numbers differ - expected: '2', found: '1'

Subtask #2:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 538ms
memory: 1268kb

input:

10000 10000
38 A
49 A
67 A
60 A
62 A
74 A
31 A
6 A
18 A
23 A
45 A
25 A
37 A
62 A
59 A
70 A
71 A
4 A
...

output:

1782
2038
3933
3088
2628
3825
3108
3406
3301
4559
4308
2974
4032
3703
3614
3782
3689
3383
3649
2906
...

result:

wrong answer 1st numbers differ - expected: '8481', found: '1782'

Subtask #3:

score: 0
Time Limit Exceeded

Test #26:

score: 0
Time Limit Exceeded

input:

30000 30000
38 A
49 A
67 A
60 A
62 A
74 A
31 A
6 A
18 A
23 A
45 A
25 A
37 A
62 A
59 A
70 A
71 A
4 A
...

output:

19398
19398
19398
19397
19398
19397
19396
19395
19394
19394
19393
19394
19393
19394
19395
19396
1939...

result:


Subtask #4:

score: 0
Skipped