Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <string>
- #include <cstring>
- #include <algorithm>
- #include <cmath>
- #include <regex>
- #include <vector>
- #include <set>
- #include <map>
- #include <stack>
- #include <queue>
- #include <deque>
- #include <unordered_map>
- #include <numeric>
- #include <iomanip>
- using namespace std;
- #define pii pair<int, int>
- #define ll long long
- #define FAST ios_base::sync_with_stdio(false); cin.tie(NULL)
- #define mp(x1, x2) ( make_pair(x1, x2) )
- const int dx[4] = {1, 0, 0, -1}, dy[4] = {0, 1, -1, 0};
- const int dl[2] = {1, -1};
- const int MOD = 100000007;
- const int MAXN = 100;
- int n;
- int x, y, z;
- int a, b, c;
- int ans = 0;
- bool check(int xx, int yy) {
- if (abs(xx - yy) <= 2) return true;
- if (abs(xx - yy) == n - 1 or abs(xx -yy) == n - 2) return true;
- return false;
- }
- int main(){
- FAST;
- //freopen("combo.in", "r", stdin);
- //freopen("combo.out", "w", stdout);
- cin >> n;
- cin >> x >> y >> z;
- cin >> a >> b >> c;
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= n; j++) {
- for (int k = 1; k <= n; k++) {
- if ((check(x, i) and check(y, j) and check(z, k)) or
- (check(a, i) and check(b, j) and check(c, k))) {
- // cout << i << " " << j << " " << k << "\n";
- ans++;
- }
- }
- }
- }
- cout << ans << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement