Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int x[3], y[3], a[3], b[3];
- map < pair <int, int>, int > mp;
- int main(){
- ios::sync_with_stdio(0);
- cin >> x[0] >> y[0] >> a[0] >> b[0];
- cin >> x[1] >> y[1] >> a[1] >> b[1];
- cin >> x[2] >> y[2] >> a[2] >> b[2];
- while (true) {
- mp[{x[0], y[0]}] = 1;
- if (a[0] == x[0] && b[0] == y[0]) break;
- if (x[0] < a[0])
- x[0]++;
- if (x[0] > a[0])
- x[0]--;
- if (y[0] < b[0])
- y[0]++;
- if (y[0] > b[0])
- y[0]--;
- }
- while (true) {
- mp[{x[1], y[1]}] = 2;
- if (a[1] == x[1] && b[1] == y[1]) break;
- if (x[1] < a[1])
- x[1]++;
- if (x[1] > a[1])
- x[1]--;
- if (y[1] < b[1])
- y[1]++;
- if (y[1] > b[1])
- y[1]--;
- }
- while (true) {
- mp[{x[2], y[2]}] = 1;
- if (a[2] == x[2] && b[2] == y[2]) break;
- if (x[2] < a[2])
- x[2]++;
- if (x[2] > a[2])
- x[2]--;
- if (y[2] < b[2])
- y[2]++;
- if (y[2] > b[2])
- y[2]--;
- }
- int yellow = 0, red = 0;
- for (auto x : mp) {
- if (x.second == 1)
- yellow++;
- else
- red++;
- }
- cout << yellow << " " << red << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement