您当前的位置: 首页 > 

2022牛客多校(九)

Lusfiee 发布时间:2022-09-23 16:38:21 ,浏览量:5

2022牛客多校(九)

文章目录
  • 2022牛客多校(九)
    • 一、比赛小结
    • 二、题目分析及解法(基础题)
    • A、Car Show
    • B、Two Frogs
    • C、Global Positioning System
    • E、Longest Increasing Subsequence
    • G、Magic Spells
    • I、The Great Wall II
    • 三、题目分析及解法(进阶题)

一、比赛小结

比赛链接:"蔚来杯"2022牛客暑期多校训练营9

二、题目分析及解法(基础题) A、Car Show

题目链接:A-Car Show

题意:

给定一个长为n的包含1,2,…,m的序列,求有多少区间[L,R]包含所有1,2,…,m。

题解:

双指针

代码:

#include 
#define int long long
using namespace std;
const int maxn = 1e5 + 5;
int t[maxn];
vector pos[maxn];
int n, m;
int nxt[maxn];
bool vis[maxn];
int ans[maxn];
signed main() {
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i  t[i], pos[t[i]].push_back(i);
  for (int i = 1; i             
关注
打赏
1688896170
查看更多评论
0.0572s