59 lines
977 B
C++
59 lines
977 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
const int mx = 101;
|
|
const int my = 103;
|
|
|
|
int main() {
|
|
ios::sync_with_stdio(0);
|
|
cin.tie(0);
|
|
|
|
vector<pair<pair<int, int>, pair<int, int>>> robots;
|
|
string line;
|
|
while (getline(cin, line) && !line.empty()) {
|
|
istringstream l(line);
|
|
l.ignore(2);
|
|
int px, py, vx, vy;
|
|
l >> px;
|
|
l.ignore(1);
|
|
l >> py;
|
|
l.ignore(3);
|
|
l >> vx;
|
|
l.ignore(1);
|
|
l >> vy;
|
|
if (vx < 0) {
|
|
vx += mx;
|
|
}
|
|
if (vy < 0) {
|
|
vy += my;
|
|
}
|
|
robots.push_back({{px, py}, {vx, vy}});
|
|
}
|
|
|
|
int q1 = 0, q2 = 0, q3 = 0, q4 = 0;
|
|
for (auto &[p, v] : robots) {
|
|
auto &[px, py] = p;
|
|
auto &[vx, vy] = v;
|
|
for (int i = 0; i < 100; i++) {
|
|
px = (px + vx) % mx;
|
|
py = (py + vy) % my;
|
|
}
|
|
|
|
if (px < mx / 2) {
|
|
if (py < my / 2) {
|
|
q1 += 1;
|
|
} else if (py > my / 2) {
|
|
q2 += 1;
|
|
}
|
|
} else if (px > mx / 2) {
|
|
if (py < my / 2) {
|
|
q3 += 1;
|
|
} else if (py > my / 2) {
|
|
q4 += 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
cout << q1 * q2 * q3 * q4 << '\n';
|
|
}
|