QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#652635#9115. Contour MultiplicationgzyWA 0ms5572kbC++14707b2024-10-18 18:57:222024-10-18 18:57:23

Judging History

你现在查看的是最新测评结果

  • [2024-10-18 18:57:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5572kb
  • [2024-10-18 18:57:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
const int N = 20;

int i, j, k, n, m, c, d, x, mo, q;
int f[2][1 << 20][N], s, u, v = 1;

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> mo >> q; s = 1 << n;
	for(j = 0; j < s; j++) for(k = 0; k <= n; k++) f[0][j][k] = 1;
	while(q--) {
		cin >> c >> d >> x;
		f[u][c][d] = 1LL * f[u][c][d] * x % mo;
		cout << f[u][c][d] << "\n";
	}
	for(i = 0; i < n; i++) {
		swap(u, v);
		for(j = 0; j < s; j++) for(k = 0; k <= n; k++) {
			f[u][j][k] = 1LL * f[v][j][k] * f[v][j ^ (1 << i)][k + 1] % mo;
		}
	}
	for(i = 0; i < s; i++) cout << f[u][i][0] << " ";
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5572kb

input:

3 100 2
0 2 4
3 0 25

output:

4
25
1 1 1 0 1 4 4 1 

result:

wrong answer 1st words differ - expected: '1', found: '4'