Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #pragma comment(linker, "/stack:16777216")
- #include <string>
- #include <vector>
- #include <map>
- #include <list>
- #include <iterator>
- #include <set>
- #include <queue>
- #include <iostream>
- #include <sstream>
- #include <stack>
- #include <deque>
- #include <cmath>
- #include <memory.h>
- #include <cstdlib>
- #include <cstdio>
- #include <cctype>
- #include <algorithm>
- #include <utility>
- using namespace std;
- #define FOR(i, a, b) for(int i = (a); i < (b); ++i)
- #define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
- #define REP(i, N) FOR(i, 0, N)
- #define RREP(i, N) RFOR(i, N, 0)
- #define FILL(A,value) memset(A,value,sizeof(A))
- #define ALL(V) V.begin(), V.end()
- #define SZ(V) (int)V.size()
- #define PB push_back
- #define MP make_pair
- #define Pi 3.14159265358979
- typedef long long Int;
- typedef unsigned long long UINT;
- typedef vector <int> VI;
- typedef pair <int, int> PII;
- const int INF = 1000000000;
- const int MAX = 74;
- const int MAX2 = 7000;
- const int BASE = 1000000000;
- struct Matrix
- {
- unsigned a[2][2];
- Matrix()
- {
- a[0][0] = a[1][1] = 1;
- a[0][1] = a[1][0] = 0;
- }
- void operator*=(Matrix b)
- {
- unsigned c[2][2];
- FILL(c,0);
- FOR(i,0,2)
- {
- FOR(j,0,2)
- {
- FOR(k,0,2)
- {
- c[i][j] += a[i][k] * b[k][j];
- }
- }
- }
- FOR(i,0,2)
- {
- FOR(j,0,2)
- {
- a[i][j] = c[i][j];
- }
- }
- }
- };
- Matrix bpow(Matrix a, Int k)
- {
- Matrix res;
- while (k)
- {
- if (k & 1)
- {
- res *= a;
- }
- a *= a;
- k /= 2;
- }
- return res;
- }
- int n,m,s,d;
- int val(int x, int y)
- {
- Matrix a;
- a.a[0][0] = 1664525;
- a.a[0][1] = 1013904223;
- a = bpow(a , 1LL * x * m + y);
- return (a.a[0][0] * s + a.a[0][1]) % 3;
- }
- int main()
- {
- #ifndef ONLINE_JUDGE
- // freopen("in.txt", "r", stdin);
- #endif
- //freopen("domino-tiling.in" , "r" , stdin);
- //freopen("domino-tiling.out" , "w" , stdout);
- cin >> n >> m >> d >> s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement