#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<=(b);++i)
#define REPD(i,a,b) for(int i=a;i>=(b);--i)
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
int p[200000+5];
int find(int x){return x==p[x]?x:p[x]=find(p[x]);
}
char s[200000+5];
int main(int argc, char const *argv[])
{int n; scanf("%d",&n);scanf("%s",s+1);REP(i,0,n+1) p[i]=i;for(int i=1;s[i];++i){if(s[i]=='<') p[i]=p[i-1];else p[i]=p[i+1];}int cnt=0;for(int i=1;s[i];++i){int f=find(i);if(f<=0||f>n) cnt++;}printf("%d\n", cnt);return 0;
}
详细解决方案
Canada Cup 2016 A.Jumping Ball并查集 .
热度:73 发布时间:2023-09-23 05:15:36.0
相关解决方案
- DirectShow Ball filter 的FillBuffer函数有关问题
- 2016/四/14腾讯Android实习面试
- 2016 黑客必备的Android应用都有哪些
- 钉钉的收费 [钉钉深圳市研发团队 denny/2016.01.06/ 59888745@qq.com]
- for(Ball b : new ArrayList<Ball>))是什么意思啊
- for(Ball b:balls)这是嘛循环?该怎么处理
- 2016 二
- Jumping to xxxxx有关问题
- SQL Server 2016 CTP2.3 的要害特性
- Canada Cup 2016 C. Hidden Word .
- Canada Cup 2016 B. Food on the Plane 找规律 .
- Canada Cup 2016 A.Jumping Ball并查集 .
- 2016 ICPC 青岛网络赛题解
- 2043. 【2016.5.21普及组模拟】约数国王(A king)
- 2042. 【2016.5.21普及组模拟】SuperPow
- 2041. 【2016.5.21普及组模拟】魔方工厂
- 【2016.5.21普及组模拟】博物馆
- hdu 1556 Color the ball (线段树+代码详解)
- U-Boot-2016.03启动分析
- csu1803-2016 湖南省大学生第十二届程序设计竞赛
- ACM-ICPC 2016 Qingdao Preliminary Contest
- 2016湖南省赛-A-2016 (思路)
- 问题 K: QAQ and steel ball discs【博弈】
- HDU 1556 Color the ball(树状数组区间更新点查询)
- 蓝桥杯国赛 2016 B
- HDU - 1087-Super Jumping! Jumping! Jumping! 【LIS变形】
- hdu4605 Magic Ball Game树上树状数组
- UVA11880 - Ball in a Rectangle
- 差分总结(c++)(例子:Color the ball )