#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; /** * Auto-generated code below aims at helping you parse * the standard input according to the problem statement. **/ struct zone{ int x; int y; }; struct enemy{ int x; int y; }; int main(){ int P; // number of players in the game (2 to 4 players) int ID; // ID of your player (0, 1, 2, or 3) int D; // number of drones in each team (3 to 11) int Z; // number of zones on the map (4 to 8) int X; // corresponds to the position of the center of a zone. A zone is a circle with a radius of 100 units. int Y; cin >> P >> ID >> D >> Z; cin.ignore(); zone n[Z]; enemy e[D][P]; int TID[Z]; // ID of the team controlling the zone (0, 1, 2, or 3) or -1 if it is not controlled. The zones are given in the same order as in the initialization. for (int i = 0; i < Z; i++) { cin >> n[i].x >> n[i].y; cin.ignore(); } // game loop while (1) { for (int i = 0; i < Z; i++) { cin >> TID[i]; cin.ignore(); } for (int i = 0; i < P; i++) { for (int j = 0; j < D; j++) { cin >> e[D][P].x >> e[D][P].y; cin.ignore(); } } for(int i=0; i<Z; i++){ if(TID[i]!=ID){ cout << n[i].x << " " << n[i].y << endl } } } } if(TID[j]==ID){ break; } else if(TID[j]!=ID){ for(int i=0; i<D; i++){ cout << n[i].x << " " << n[i].y << endl; } } else if(TID[j]==-1){ for(int i=0; i<D; i++){ cout << n[i].x << " " << n[i].y << endl; } } include <iostream> #include <string> #include <cmath> #include <vector> #include <cstdlib> #include <ctime> using namespace std; static const int AREA_RADIUS = 100; typedef struct Point_ { int x = 0; int y = 0; } Point; typedef struct Drone_ { Point pos; // position of the drone } Drone; typedef struct Zone_ { Point center; // center of this zone (circle radius = 100 units) int ownerId = -1; // ID of the team which owns this zone, -1 otherwise } Zone; typedef struct Team_ { vector<Drone*> drones; // drones of the team } Team; typedef struct Game_ { vector<Zone*> zones; // all game zones vector<Team*> teams; // all the team of drones. Array index = team's ID int myTeamId; // index of my team in the array of teams // read initial games data (one time at the beginning of the game: P I D Z...) void init() { int p, i, d, z; cin >> p >> i >> d >> z; myTeamId = i; for(int areaId = 0; areaId < z; areaId++) { int x, y; Zone *z = new Zone(); cin >> z->center.x >> z->center.y; zones.push_back(z); } for(int teamId = 0; teamId < p; teamId++) { Team *t = new Team(); teams.push_back(t); for(int droneId = 0; droneId < d; droneId++) { Drone *drone = new Drone(); t->drones.push_back(drone); } } } // Run the main loop (parse inputs and play) void run() { while (true) { for(Zone *zone : zones) { cin >> zone->ownerId; // update zones owner } for(Team *team : teams) { for(Drone * drone : team->drones) { cin >> drone->pos.x >> drone->pos.y; // update drones position } } play(); } } // Compute logic here. This method is called for each game round. void play() { vector<Drone*> myDrones = teams[myTeamId]->drones; // here I always ask my drones to reach the bottom right corner... stupid :-) for(Drone *drone : myDrones) { cout << "3999 1799" << endl; } } } Game; int main() { Game g; g.init(); g.run(); return 0; } #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; /** * Auto-generated code below aims at helping you parse * the standard input according to the problem statement. **/ struct zone{ int x; int y; }; struct enemy{ int x; int y; }; int main(){ int P; // number of players in the game (2 to 4 players) int ID; // ID of your player (0, 1, 2, or 3) int D; // number of drones in each team (3 to 11) int Z; // number of zones on the map (4 to 8) int X; // corresponds to the position of the center of a zone. A zone is a circle with a radius of 100 units. int Y; cin >> P >> ID >> D >> Z; cin.ignore(); zone n[Z]; enemy e[D][P]; int TID[Z]; // ID of the team controlling the zone (0, 1, 2, or 3) or -1 if it is not controlled. The zones are given in the same order as in the initialization. for (int i = 0; i < Z; i++) { cin >> n[i].x >> n[i].y; cin.ignore(); } // game loop int check=0; while (1) { for (int i = 0; i < Z; i++) { cin >> TID[i]; cin.ignore(); } for (int i = 0; i < P; i++) { for (int j = 0; j < D; j++) { cin >> e[D][P].x >> e[D][P].y; cin.ignore(); } } for(int j=0; j<D; j++){ cout << n[0].x << " " << n[0].y << endl; for(int k=0; k<D; k++){ if(TID[ID]==ID){ check++; if(check==D) break; }a } } for(int j=0; j<D; j++){ cout << n[1].x << " " << n[1].y << endl; for(int k=0; k<D; k++){ if(TID[ID]==ID){ check++; if(check==D) break; } } } } }
{"metaMigratedAt":"2023-06-15T11:43:44.522Z","metaMigratedFrom":"Content","title":"Untitled","breaks":true,"contributors":"[{\"id\":\"0bbcbcce-0993-4c67-a123-c2a01b1edfc2\",\"add\":6022,\"del\":0}]"}
Expand menu