51 nod 1521 一维战舰 时间复杂度O(n),同 Codeforces 567D. One-Dimensional Battle Ships 有详细注释

题目:51nod: 题目Codeforces:       题目注意到两个战舰不能挨在一起就可以了。   // 每一段 struct node{ int left; // 段的左端点 int right; // 段的右端点 int length; // 段长度 int ship; // 段最大容纳战舰数 }arr[200005]; 每一段可容纳战舰数: sh
相关文章
相关标签/搜索