why E wa2
  • 板块学术版
  • 楼主apiad
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/7/13 22:17
  • 上次更新2024/7/14 09:20:42
查看原帖
why E wa2
1251532
apiad楼主2024/7/13 22:17
// Author: Expert_Dream
// Copyright (c) 2024 Expert_Dream All rights reserved.
// Problem: E - Count Arithmetic Subsequences
// Contest: AtCoder - Toyota Programming Contest 2024#7(AtCoder Beginner Contest 362)
// URL: https://atcoder.jp/contests/abc362/tasks/abc362_e
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Date: 2024-07-13 20:00:27

// Author: Expert_Dream
// Copyright (c) 2024 Expert_Dream All rights reserved.
// Problem: P6419 [COCI2014-2015#1] Kamp
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P6419
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// Date: 2024-07-06 22:14:50

// #pragma GCC optimize(2,3,"Ofast","inline")
#include<bits/stdc++.h>
// #include <atcoder/all>
#define ll long long
#define i128 __int128
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fs first
#define sc second
#define x0 _x0_
#define y1 _y1_
#define endl '\n'
#define re register
#define pb push_back
#define vi vector<int>
#define pq priority_queue
#define mem(a,x) memset((a),(x),sizeof(a))
#define debug(x) cout<<"debug:"<<x<<endl;
#define sz(s) (int)(s.size())
#define all(a) a.begin(),a.end()
#define rd(l,r) (myrand()%(r-l+1)+l)
#define print(x) {cout<<x<<endl;return;}
#define For(x,y,z) for(int x = y;x <= z;x++)
#define For_(x,y,z) for(int x = y;x >= z;x--)
#define between(x, flo, top) (flo <= x && x <= top)
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"
#define em(x) x.empty()
// #define double long double
using namespace std;
// using namespace atcoder;
mt19937 myrand(time(0));
template <typename Type> void get_min(Type &w1,const Type w2) { if(w2<w1) w1=w2; } 
template <typename Type> void get_max(Type &w1,const Type w2) { if(w2>w1) w1=w2; }
template <typename Type> Type up_div(Type w1,Type w2) { return (w1/w2+(w1%w2?1:0)); }//向上取整
template <typename Type> Type gcd(Type a,Type b) {long long i=__builtin_ctz(a),j=__builtin_ctz(b),x=i>j?j:i,y;b>>=j;while(a){a>>=i;y=b-a;i=__builtin_ctz(y);b=a<b?a:b;a=y<0?-y:y;}return b<<x;}
template <typename Type> Type lcm(Type a,Type b) {return a/gcd(a,b)*b;}
template <typename Type> Type ksm(Type a,Type b) {int res=1;while(b){if(b&1) res=res*a;a=a*a;b>>=1;}return res;}
template <typename Type> Type ksm(Type a,Type b,Type mod) {int res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return res%mod;}
inline int Sqrt(int x){int l = 1, r = sqrtl(x) + 10; while (l < r) {int mid = l + r + 1 >> 1; if (mid * mid <= x) l = mid; else r = mid - 1;}return l;}
namespace FastIO {template <typename T = int>inline T read() {T s=0,w=1;char c=getchar();while(!isdigit(c)){if(c=='-')w=-1;c=getchar();}while(isdigit(c))s=(s<<1)+(s<<3)+(c^48),c=getchar();return s*w;}template <typename T>inline void read(T &s){s=0;int w=1;char c=getchar();while(!isdigit(c)){if(c=='-')w=-1;c=getchar();}while(isdigit(c))s=(s<<1)+(s<<3)+(c^48),c=getchar();s*=w;}template <typename T, typename... Args> inline void read(T &x, Args &...args) {read(x), read(args...);}template <typename T>inline void write(T x,char ch = '\n') {if(x<0)x=-x,putchar('-');static char stk[200];int top=0;do{stk[top++]=x%10+'0',x/=10;}while(x);while(top)putchar(stk[--top]);putchar(ch);return;}template <typename T, typename... Args> inline void write(T x, Args ...args) {write(x,' '), write(args...);}template <typename Type> void Write(vector<Type> v) {for(auto it:v)write(it,' ');puts("");}}
using namespace FastIO;
#define int long long
const int mod = 998244353,inf = 0x3f3f3f3f,N = 80+5,M = 1e6+5,K = 3000+5;// 1000000007
const long long linf = 0x3f3f3f3f3f3f3f3f;
int n;
int a[N];
int dp[N][N*N][N];
map<int,int> mp;
int cnt=0;
vector<int> b[N][N*N];
void solve(){
	cin >> n;
	For(i,1,n)cin >> a[i];
	For(i,1,n) For(j,i+1,n){
		if(!mp[a[j]-a[i]]){
			mp[a[j]-a[i]]=++cnt;
		}b[j][mp[a[j]-a[i]]].pb(i);
	}
	For(i,1,n)
		For(j,1,cnt)
			dp[i][j][1]=1;
	For(len,2,n)For(i,len,n){
		For(j,1,cnt){	
			for(auto it:b[i][j]){
				dp[i][j][len] += dp[it][j][len-1];
			}
		}
	}
	cout<<n<<" ";
	For(i,2,n){
		int ans=0;
		For(x,i,n)For(y,1,cnt) ans+=dp[x][y][i];
		cout<<ans<<" ";
	}
	
	// For(i,1,n)For(j,1,cnt)For(len,1,n) cout<<i<<" "<<j<<" "<<len<<" "<<dp[i][j][len]<<endl;
}signed main(){
	// freopen("std.in","r",stdin);
	// freopen("std.out","w",stdout);
	// ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	int T=1;
	// read(T);
	For(_,1,T) solve();
	return 0;
}
/*
4 6 1 0 1 1 1 1
1 1 2 0
1 1 3 0
1 1 4 0
1 2 1 1
1 2 2 0
1 2 3 0
1 2 4 0
1 3 1 1
1 3 2 0
1 3 3 0
1 3 4 0
2 1 1 1*
2 1 2 1
2 1 3 0
2 1 4 0
2 2 1 1
2 2 2 0
2 2 3 0
2 2 4 0
2 3 1 1
2 3 2 0
2 3 3 0
2 3 4 0
3 1 1 1
3 1 2 0*
3 1 3 0
3 1 4 0
3 2 1 1
3 2 2 1
3 2 3 0
3 2 4 0
3 3 1 1
3 3 2 1
3 3 3 0
3 3 4 0
4 1 1 1
4 1 2 0
4 1 3 0
4 1 4 0
4 2 1 1
4 2 2 0
4 2 3 0
4 2 4 0
4 3 1 1
4 3 2 3
4 3 3 1
4 3 4 0

*/
2024/7/13 22:17
加载中...