Submission #22225

# Submission time Handle Problem Language Result Execution time Memory
22225 2017-04-30T02:25:29 Z a(#1038, wimzzang) None (KRIII5P_2) C++
2 / 7
1000 ms 5928 KB
#include <iostream>
#include <stdio.h>
#include <vector>

using namespace std;

int P;
int fMOD_P(const vector<int> &a, const int x) {
	int xPow = 1;
	int fx = 0;
	for (int i = 0; i < a.size(); i++) {
		fx = (fx + a[i] * xPow) % P;
		xPow = (xPow*x) % P;
	}
	return fx;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//setbuf(stdout, NULL);

	int N; cin >> N >> P;
	vector<int> a(N + 1);
	for (int i = N; i >= 0; i--) {
		cin >> a[i];
		a[i] = a[i] % P;
	}
	for (int i = 0; i < P; i++)
		cout << fMOD_P(a, i) << endl;
	return 0;
}

Compilation message

pc.cpp: In function 'int fMOD_P(const std::vector<int>&, int)':
pc.cpp:11:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < a.size(); i++) {
                    ^
# 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 Correct 0 ms 2020 KB Output is correct
4 Correct 0 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 13 ms 2020 KB Output is correct
7 Correct 16 ms 2020 KB Output is correct
8 Correct 9 ms 2020 KB Output is correct
9 Correct 16 ms 2020 KB Output is correct
10 Correct 16 ms 2020 KB Output is correct
11 Correct 9 ms 2020 KB Output is correct
12 Correct 13 ms 2020 KB Output is correct
13 Correct 3 ms 2020 KB Output is correct
14 Correct 0 ms 2020 KB Output is correct
15 Correct 3 ms 2020 KB Output is correct
# 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 Correct 0 ms 2020 KB Output is correct
4 Correct 0 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 13 ms 2020 KB Output is correct
7 Correct 16 ms 2020 KB Output is correct
8 Correct 9 ms 2020 KB Output is correct
9 Correct 16 ms 2020 KB Output is correct
10 Correct 16 ms 2020 KB Output is correct
11 Correct 9 ms 2020 KB Output is correct
12 Correct 13 ms 2020 KB Output is correct
13 Correct 3 ms 2020 KB Output is correct
14 Correct 0 ms 2020 KB Output is correct
15 Correct 3 ms 2020 KB Output is correct
16 Correct 496 ms 5928 KB Output is correct
17 Correct 513 ms 5928 KB Output is correct
18 Correct 519 ms 5928 KB Output is correct
19 Correct 619 ms 5928 KB Output is correct
20 Correct 623 ms 5928 KB Output is correct
21 Execution timed out 1000 ms 5928 KB Execution timed out
22 Halted 0 ms 0 KB -