Commit c8a42b62 authored by 24OI-bot's avatar 24OI-bot
Browse files

style: format markdown files with remark-lint

parent b9d93f4c
Loading
Loading
Loading
Loading
+18 −24
Original line number Diff line number Diff line
@@ -97,8 +97,7 @@ map<string, int> mp;
```cpp
set<int> s;
typedef set<int>::iterator si;
for(si it=s.begin();it!=s.end();it++)
  cout<<*it<<endl;
for (si it = s.begin(); it != s.end(); it++) cout << *it << endl;
```

需要注意的是,对 `map` 的迭代器解引用后,得到的是类型为 `pair<Key, T>` 的键值对。
@@ -107,8 +106,7 @@ for(si it=s.begin();it!=s.end();it++)

```cpp
set<int> s;
for(auto x:s)
  cout<<x<<endl;
for (auto x : s) cout << x << endl;
```

对于任意关联式容器,使用迭代器遍历容器的时间复杂度均为 $O(n)$ 。
@@ -124,12 +122,8 @@ for(auto x:s)
例如,我们想要维护一个存储整数,且较大值靠前的 `set` ,可以这样实现:

```cpp
struct cmp
{
 bool operator()(int a,int b)
 {
  return a>b;
 }
struct cmp {
  bool operator()(int a, int b) { return a > b; }
};
set<int, cmp> s;
```