记录编号 321085 评测结果 AAAAAAAAAA
题目名称 [HZOI 2015]快速柚立叶变换 最终得分 100
用户昵称 GravatarFmuckss 是否通过 通过
代码语言 C++ 运行时间 0.003 s
提交时间 2016-10-13 12:25:48 内存使用 11.76 MiB
显示代码纯文本
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
const int maxn = 1e6 + 10;

#define is_num(x) (x <= '9' and x >= '0')
inline LL get_num() {
	char tmp = getchar();
	LL res = 0;
	
	while (not is_num(tmp)) tmp = getchar();
	while (    is_num(tmp)) {
		res = (res << 3) + (res << 1) + tmp - '0';
		tmp = getchar();
	}
	
	return res;
}

LL seq[maxn];
int app[maxn];
int n;

inline void solve() {
	n = get_num();
	LL sum = 0;
	app[0] = 1;
	
	for (int i = 1; i <= n; i++) {
		seq[i] = get_num();
		// if(not seq[i]) continue; 
		sum = (sum + seq[i]) % n;
		
		if (app[sum]) {
			for (int j = app[sum]; j <= i; j++) {
				printf("%lld ", seq[j]);
			}
			printf("\n");
			return;
		}
		
		app[sum] = i + 1;
	}
	
	printf("Tree in Tree with chairman tree.\n");
}

int main() {
	freopen("A_long_name_without_mean.in", "r", stdin);
	freopen("A_long_name_without_mean.out", "w", stdout);
	solve();
	return 0;
}