#
|
用 户 名 | 公园 | 计划 | 抽卡 | 总分 |
19
|
859乔屹 | 100
03:15:05
|
40
03:14:01
|
140
03:15:05
|
emm
怎么讲
T2我把自己优化掉了40分
优化前:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#define cin(a) scanf("%d",&a)
using namespace std;
const int maxn=1e5+5;
int dui[maxn],siz,now,last;
int a[maxn];
int m,n,qu;
int ri[maxn];
int len[maxn];
int sum[maxn];
long long ans[maxn];
struct node{
int l,r,k;
}t[maxn];
__attribute((always_inline))int h233(const node &a,const node &b)
{return a.r==b.r?a.l<b.l:a.r<b.r;}
int main()
{
// freopen("ans.in","r",stdin);
// freopen("a.out","w",stdout);
cin(n),cin(m),cin(qu);
for(int q=1;q<=n;q++)
cin>>a[q];
for(int q=1;q<=n;q++)
{
while(siz<m&&now<n)
{
++now;
if(!dui[a[now]])
++siz;
++dui[a[now]];
}
if(siz>=m)
ri[q]=now;
else
{
last=q;
break;
}
dui[a[q]]