#include<bits/stdc++.h>
using namespace std;
using uid = uniform_int_distribution<int>;
mt19937 rng(time(0));
const int N = 1e4 + 7;
long long t[N][N];
const long long mod = 1e9+7;
int r1, r2, r3;
long long a, n, b, x, y, XD;
string k1, k2, k3;
int main() {
ios_base::sync_with_stdio(0);
cin >> n;
cin >> r1 >> k1 >> r2 >> k2 >> r3 >> k3;
XD = n;
if(k1 == k2) {
swap(k2, k3);
swap(r2, r3);
}
if(k1 == k2 || k2 == k3 || k1 == k3) XD = 1;
for(int i = 0; i < n; i++) {
if(k1[i] == k2[i]) {
a++;
if(k1[i] == '1') x++;
}
else b++, y++;
}
cout << uid(0,min((long long)(1e9 + 7),n*n*XD))(rng);
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include<bits/stdc++.h> using namespace std; using uid = uniform_int_distribution<int>; mt19937 rng(time(0)); const int N = 1e4 + 7; long long t[N][N]; const long long mod = 1e9+7; int r1, r2, r3; long long a, n, b, x, y, XD; string k1, k2, k3; int main() { ios_base::sync_with_stdio(0); cin >> n; cin >> r1 >> k1 >> r2 >> k2 >> r3 >> k3; XD = n; if(k1 == k2) { swap(k2, k3); swap(r2, r3); } if(k1 == k2 || k2 == k3 || k1 == k3) XD = 1; for(int i = 0; i < n; i++) { if(k1[i] == k2[i]) { a++; if(k1[i] == '1') x++; } else b++, y++; } cout << uid(0,min((long long)(1e9 + 7),n*n*XD))(rng); return 0; } |
English