Submission #74449

# Submission time Handle Problem Language Result Execution time Memory
74449 2018-09-02T03:20:07 Z TAMREF None (KRIII5P_2) C++11
0 / 7
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll a[1005];
int n, p, a0;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n >> p;
	for(int i = n, x; i >= 0; i--){
		cin >> x;
		a[i % p] += x;
		if(!i) a0 = x;
	}
	for(int i = p; i--;) a[i] %= p;
	for(int j = 0; j < p; j++){
		if(!j){
			printf("%d\n",a0);
			continue;
		}
		int k = 1;
		int ans = 0;
		for(int i = 0; i <= p; i++){
			ans = (ans + k * a[i]) % p;
			k = k * j % p;
		}
		printf("%d\n",ans);
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -