Submission #74451

# Submission time Handle Problem Language Result Execution time Memory
74451 2018-09-02T03:20:44 Z TAMREF None (KRIII5P_2) C++11
2 / 7
163 ms 708 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%p);
			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 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 612 KB Output is correct
5 Correct 2 ms 672 KB Output is correct
6 Correct 23 ms 672 KB Output is correct
7 Correct 22 ms 672 KB Output is correct
8 Correct 24 ms 672 KB Output is correct
9 Correct 22 ms 688 KB Output is correct
10 Correct 23 ms 688 KB Output is correct
11 Correct 15 ms 688 KB Output is correct
12 Correct 23 ms 708 KB Output is correct
13 Correct 7 ms 708 KB Output is correct
14 Correct 4 ms 708 KB Output is correct
15 Correct 5 ms 708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 612 KB Output is correct
5 Correct 2 ms 672 KB Output is correct
6 Correct 23 ms 672 KB Output is correct
7 Correct 22 ms 672 KB Output is correct
8 Correct 24 ms 672 KB Output is correct
9 Correct 22 ms 688 KB Output is correct
10 Correct 23 ms 688 KB Output is correct
11 Correct 15 ms 688 KB Output is correct
12 Correct 23 ms 708 KB Output is correct
13 Correct 7 ms 708 KB Output is correct
14 Correct 4 ms 708 KB Output is correct
15 Correct 5 ms 708 KB Output is correct
16 Correct 142 ms 708 KB Output is correct
17 Incorrect 163 ms 708 KB Output isn't correct
18 Halted 0 ms 0 KB -