Submission #74448

# Submission time Handle Problem Language Result Execution time Memory
74448 2018-09-02T03:10:36 Z TAMREF None (KRIII5P_2) C++17
2 / 7
143 ms 20192 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
ll a[1005];
int n, p;
 
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;
	}
	for(int i = p; i--;) a[i] %= p;
	for(int j = 0; j < p; j++){
		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 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 536 KB Output is correct
5 Correct 2 ms 580 KB Output is correct
6 Correct 22 ms 584 KB Output is correct
7 Correct 22 ms 688 KB Output is correct
8 Correct 21 ms 688 KB Output is correct
9 Correct 21 ms 688 KB Output is correct
10 Correct 21 ms 688 KB Output is correct
11 Correct 15 ms 708 KB Output is correct
12 Correct 17 ms 844 KB Output is correct
13 Correct 7 ms 844 KB Output is correct
14 Correct 4 ms 844 KB Output is correct
15 Correct 5 ms 844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 536 KB Output is correct
5 Correct 2 ms 580 KB Output is correct
6 Correct 22 ms 584 KB Output is correct
7 Correct 22 ms 688 KB Output is correct
8 Correct 21 ms 688 KB Output is correct
9 Correct 21 ms 688 KB Output is correct
10 Correct 21 ms 688 KB Output is correct
11 Correct 15 ms 708 KB Output is correct
12 Correct 17 ms 844 KB Output is correct
13 Correct 7 ms 844 KB Output is correct
14 Correct 4 ms 844 KB Output is correct
15 Correct 5 ms 844 KB Output is correct
16 Correct 133 ms 10384 KB Output is correct
17 Incorrect 143 ms 20192 KB Output isn't correct
18 Halted 0 ms 0 KB -