8-7 Unique Snowflakes UVA11572】的更多相关文章

输入一个长度为n n<=10 6  的序列A  找到一个尽量长的连续子序列  使得该序列中没有相同的元素 用滑动窗口法   时间复杂度n  好神奇 此题非常经典 map   410ms #include<bits/stdc++.h> using namespace std; #define N 100000000 long a[N]; int main() { int cas; cin>>cas; while(cas--) { int n;cin>>n; ;i&l…
Emily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captures snowflakes as they fall, and serializes them into a stream of snowflakes that flow, one by one, into a package. Once the packag…
题目: Emily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captures snowflakes as they fall, and serializes them into a stream of snowflakes that flow, one by one, into a package. Once the pa…
Emily the entrepreneur has a cool business idea: packaging and selling snowakes. She has devised amachine that captures snowakes as they fall, and serializes them into a stream of snowakes that ow,one by one, into a package. Once the package is full,…
Emily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captures snowflakes as they fall, and serializes them into a stream of snowflakes that flow, one by one, into a package. Once the package is…
用STL做会很方便 SET: /*by SilverN*/ #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #include<cmath> #include<set> using namespace std; ; int a[mxn]; int n,T; int main(){ scanf("%d",&T);…
题意:给出 n个数,找到尽量长的一个序列,使得该序列中没有重复的元素 看的紫书,滑动窗口来做的 当右端碰到有相同的数的时候,左端向前滑动一个数 模拟一个样例好理解些 #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #include<stack> #include<vector> #include<map> #include<…
滑动窗口挺有意思的,如果符合条件右端点一直向前走,不符合的话,左端点向前走. #include <bits/stdc++.h> using namespace std; set<int> Set; + ; int a[maxn]; int Scan() { //输入外挂 ; char ch; ') res = res * + (ch - '); return res; } int main() { //freopen("in.txt", "r"…
/* STLsort离散化==T 手工sort离散化==T map在线==T map离线处理c==A 240ms */ #include<cstdio> #include<map> #define maxn 1000010 using namespace std; int T,n,c[maxn],a[maxn],ans,s,t,num; map<int,int>p; int init(){ ,f=;char s=getchar(); ;s=getchar();} +s-…
本书是关于使用刘汝佳set, 通过收集找到.count()和删除.erase().这种方法比我好.用较短的时间. 我想map这个任务可以完成.但是,这是不容易删除,必须先找到find()标.然后删除索引对应的元素 但map有map的使用方法.以下的方法就是比較easy实现的一种方法. 我本想着这个一边读完就计算出了ans,应该更快一点的.可是其实还不如先读再用set处理来得快. #include<cstdio> #include<iostream> #include<map&…