Problem 3795 --Array

3795: Array

"
Time Limit $1$ 秒/Second(s) Memory Limit $128$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
Given an integer array a[1..n].

Count how many subsegment [L,R] satisfying R−L+1≥1 and there is a kind of integer whose number of occurrences is strictly greater than the sum of others in a[L..R].
The first line contains an integer T(T≤15). Then T test cases follow.

For each test case, input two lines.
For the first line, there is only one integer n (1≤n≤106).

The second line contains n integers describing the array a[1..n], while the restriction 0≤ai≤106 is guaranteed.

∑n<=6∗106
For each test case, output a integer per line, denoting the answer of the problem.
1
10
3303 70463 3303 3303 3303 70463 3303 3303 70463 70463
47

推荐代码 查看3795 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛