T1有多少人不是写的线段树。。

被骗了。。

花一个半小时把线段树调出来,考试结束后发现有些julao直接排序就水过去了QAQ
全部评论
T1不是输出答案题吗?只要会用读入和输出基本都能A吧
8 回复
分享
发布于 2019-11-05 22:14
不是离散化之后随便做吗?
3 回复
分享
发布于 2019-11-05 22:06
联想
校招火热招聘中
官网直投
这和线段树到底有何关系
2 回复
分享
发布于 2019-11-06 18:20
不是STL练习题吗
1 回复
分享
发布于 2019-11-05 22:07
我,但是没过
1 回复
分享
发布于 2019-11-05 22:18
用了一个set和一个multiset,20分QwQ
1 回复
分享
发布于 2019-11-06 08:16
对啊,hash or 基数排序 可以O(n)
点赞 回复
分享
发布于 2019-11-05 22:07
哎?线段树?OwO 大概是排序后离散化然后数学计算一下(计算过程O(N))就可以了呀?
点赞 回复
分享
发布于 2019-11-05 22:09
看见dalao们在装逼,不好说什么,爆零的我只好说一句: %%%
点赞 回复
分享
发布于 2019-11-05 22:11
T1 。。。 我是树状数组的(滑稽
点赞 回复
分享
发布于 2019-11-05 22:15
作者:520Enterprise 链接:https://ac.nowcoder.com/discuss/335697?type=101&order=0&pos=1&page=1 来源:牛客网 #include<cmath> #include<cstdio> #include<iostream> #include<cstdlib> #include<algorithm> #include<cstring> #include<map> #include<queue> #include<set> #include<vector> #include<bitset> #define int __int128 #define ll __int128 using namespace std; const int maxn=300005; const long long mod=1e9+7; int n; ll k,sum,a[maxn],shika[maxn],f1,f2,f3,erci,yici,changshu; map<ll,ll>pre; inline ll read() {     ll x=0,f=1;     char ch=getchar();     while(ch<'0'||ch>'9')     {         if(ch=='-')             f=-1;         ch=getchar();     }     while(ch>='0'&&ch<='9')     {         x=(x<<1)+(x<<3)+(ch^48);         ch=getchar();     }     return x*f; } inline void write(ll a) {     if(a<0)     {         char a='-',b='1';         putchar(a);         putchar(b);     }     else     {         if(a>=10)             write(a/10);         putchar(a%10+'0');     } } void jiefangcheng(int f1,int f2,int f3) {     erci=(f3+f1-2*f2)/2;     erci%=mod;     yici=f2-f1-3*erci;     yici%=mod;     changshu=f1-erci-yici;     changshu%=mod; } signed main() {     n=read(),k=read();     for(int i=1;i<=n;++i)         a[i]=a[i+n]=a[i+2*n]=read();     for(int i=1;i<=3*n;++i)     {         if(pre.find(a[i])==pre.end())             pre[a[i]]=0;         shika[i]=(shika[i-1]+pre[a[i]])%mod; //      cout<<shika[i]<<' ';         sum=(sum+i*(i+1)/2-shika[i])%mod;         if(i==n)             f1=sum;         if(i==2*n)             f2=sum;         if(i==3*n)             f3=sum;         pre[a[i]]=i;     }     jiefangcheng(f1,f2,f3); //  cout<<f1<<' '<<f2<<' '<<f3<<endl; //  cout<<erci<<' '<<yici<<' '<<changshu<<endl;     write(((erci*k%mod*k%mod+yici*k%mod+changshu)%mod+mod)%mod);     return 0; } 90分求助
点赞 回复
分享
发布于 2019-11-05 22:21
我过了
点赞 回复
分享
发布于 2019-11-06 06:13
随便推推式子就可以了
点赞 回复
分享
发布于 2019-11-06 07:40
dengcha 数列
点赞 回复
分享
发布于 2019-11-06 13:57
没用线段树路过...
点赞 回复
分享
发布于 2019-11-06 20:03

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务