Submission #22181

# Submission time Handle Problem Language Result Execution time Memory
22181 2017-04-29T14:54:38 Z sdfgsfg(#1031, zzze17) None (KRIII5P_2) C++11
0 / 7
0 ms 5928 KB
#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int n, p;
	cin >> n >> p;
	vector<int> a(1000000);
	for (int i = 0; i < n+1; i++)
	{
		int temp;
		cin >> temp;
		a[n-i] = temp;
	}


	int res = 0;
	int pow = 1;

	for (int i = 0; i < p; i++)
	{
		for (int j = 1; j < n+1; j++)
		{
			pow *= i;
			pow %= p;
			
			res += (pow * a[j] % p);
			res %= p;
		}

		cout << (res+a[0])%p << endl;
		res = 0; pow = 1;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5928 KB Output is correct
2 Correct 0 ms 5928 KB Output is correct
3 Incorrect 0 ms 5928 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5928 KB Output is correct
2 Correct 0 ms 5928 KB Output is correct
3 Incorrect 0 ms 5928 KB Output isn't correct
4 Halted 0 ms 0 KB -