Submission #22226

# Submission time Handle Problem Language Result Execution time Memory
22226 2017-04-30T02:36:22 Z 현재PC방은도타2가점령!!(#1002, exqt) None (KRIII5P_2) C++
0 / 7
0 ms 2020 KB
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <utility>
#include <string>
#include <set>
#include <map>
using namespace std;

int main()
{
	// freopen("in.txt", "r+", stdin);
	// freopen("out.txt", "w+", stdout);

	long long n, p; cin >> n >> p;
	vector<long long> a(n+1);
	for(long long i=n; i>=0; i--) cin >> a[i];
	long long c = a[0];
	a[0] = 0;
	
	for(long long i=p-1; i<=n; i++)
	{
		a[i%(p-1)] = (a[i%(p-1)] + a[i]) % p;
	}

	for(long long i=0; i<p; i++)
	{
		long long r = 0;
		long long t = i;
		for(long long j=0; j<p-1; j++)
		{
			r = (r + t * a[j]) % p; 
			t = (t * i) % p;
		}

		cout << (r + c) % p << endl;
	}

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Incorrect 0 ms 2020 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Incorrect 0 ms 2020 KB Output isn't correct
4 Halted 0 ms 0 KB -