Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- const int maxn = 1000 + 100;
- int n, m, ans;
- int x[3], idx[3], num[3];
- int a[3][maxn];
- int cal() {
- if (num[0] == num[1] - 1 && num[1] == num[2] - 1) {
- return 200;
- }
- if (num[0] == num[1] && num[1] == num[2]) {
- return 200;
- }
- sort(num, num + 3);
- if (num[0] == num[1] - 1 && num[1] == num[2] - 1) {
- return 100;
- }
- if (num[0] == num[1] || num[1] == num[2]) {
- return 100;
- }
- return 0;
- }
- int main() {
- #ifdef ExRoc
- freopen("test.txt", "r", stdin);
- #endif // ExRoc
- cin >> n;
- for (int i = 0; i < 3; ++i) {
- for (int j = 0; j < n; ++j) {
- cin >> a[i][j];
- }
- }
- cin >> m;
- for (int i = 0; i < m; ++i) {
- for (int j = 0; j < 3; ++j) {
- cin >> x[j];
- idx[j] = (idx[j] + x[j]) % n;
- num[j] = a[j][idx[j]];
- }
- ans += cal();
- }
- cout << ans << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement