题意:
给你一个数组,可以像题目那样无限拼接,问递增子序列的最大长度(可不连续)。
思路:
序列的最大长度即为数组中不同元素的个数。
Tips:
一开始不知道back-to-back什么意思,看到题目立刻懂了2333。
#include <bits/stdc++.h> using namespace std; void solve(){ int n;cin>>n; set<int> s; for(int i=0;i<n;i++){ int t;cin>>t; s.insert(t); } cout<<s.size()<<endl; } int main(){ int t;cin>>t; while(t--) solve(); return 0; }