Click
Here to go back to the homepage.
Splat Solution:
#include <bits/stdc++.h>
using namespace std;
int main(){
// #ifndef TESTING
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int nPaintings;
cin >> nPaintings;
while(nPaintings--){
int nDrops;
cin >> nDrops;
vector<tuple<double, double, double, string>> drops(nDrops);
for(int i = nDrops - 1; i >= 0; i--){
double x, y, v;
string s;
cin >> x >> y >> v >> s;
drops[i] = {x, y, sqrt(v / 3.14159265358979323846264), s};
}
int points;
cin >> points;
while(points--){
double x, y;
cin >> x >> y;
string color = "white";
for(tuple<double, double, double, string> t: drops){
double circX = x - get<0>(t);
double circY = y - get<1>(t);
if(sqrt(circX * circX + circY * circY) <= get<2>(t)){
color = get<3>(t);
break;
}
}
cout << color << endl;
}
}
return 0;
}