C. Sequence Pair Weight——Codeforces Round #721 (Div. 2)
Posted 出尘呢
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C. Sequence Pair Weight——Codeforces Round #721 (Div. 2)相关的知识,希望对你有一定的参考价值。
https://codeforces.com/contest/1527/problem/C
A sequence b is a subsegment of a sequence a if b can be obtained from a by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
——题意看清!!several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
弄成子列了,不要这样。还用py做了大数。。
比赛时,不要慌,思路仍然要想透想深一点
#include<bits/stdc++.h>
#ifdef LOCAL
FILE*FP=freopen("text.in","r",stdin);
#endif
using namespace std;
#define int unsigned long long
//题意看清!
map<int,int>m;
signed main(){
int t;
scanf("%llu",&t);//long long输入
while(t--){
int n;
scanf("%llu",&n);
m.clear();
int te,sum=0;
for(int i=0;i<n;i++){
scanf("%llu",&te);
sum+=m[te]*(n-i);
m[te]+=(i+1);
}
printf("%llu\\n",sum);
}
return 0;
}
以上是关于C. Sequence Pair Weight——Codeforces Round #721 (Div. 2)的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Round #721 (Div. 2) C. Sequence Pair Weight
Codeforces Round #721 (Div. 2) C. Sequence Pair Weight
Codeforces Round #721 (Div. 2) C. Sequence Pair Weight