Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using uint = unsigned int;
- using ll = long long;
- using ull = unsigned long long;
- using pii = pair<int, int>;
- using pll = pair<ll, ll>;
- #define dbg(x) cerr<<#x": "<<(x)<<endl
- #define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
- #define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
- #define all(v) v.begin(), v.end()
- #define fi first
- #define se second
- template<typename T1, typename T2>
- ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
- out << item.first << " " << item.second;
- return out;
- }
- template<typename T>
- ostream& operator <<(ostream &out, const vector<T> &v) {
- for(const auto &item : v) out << item << ' ';
- return out;
- }
- const int NMAX = 5010;
- int dl[] = { 0, 1, 0, -1 };
- int dc[] = { -1, 0, 1, 0 };
- double speed;
- int n, wx, wy;
- char comm[NMAX];
- int step[NMAX], spawnTime[NMAX];
- int tx[NMAX], ty[NMAX];
- int state[NMAX];
- vector<int> toSpawn[NMAX];
- set<int> alive;
- struct lol {
- int currStep, x, y, dir, i;
- double acc, hp;
- bool updatePos(int tick) {
- acc += speed;
- while(acc >= 1) {
- while(comm[i] == 'T' && i < n) {
- dir = (dir + step[i]) % 4;
- ++i;
- currStep = 0;
- }
- if(i == n) return false;
- acc -= 1;
- ++currStep;
- x += dl[dir];
- y += dc[dir];
- if(currStep == step[i]) {
- ++i;
- currStep = 0;
- }
- if(i == n) return false;
- }
- return true;
- }
- };
- lol v[NMAX];
- int getDist(int x1, int y1, int x2, int y2) {
- return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
- }
- vector<vector<int>> getHarta(int x, int y) {
- v[NMAX - 1].i = 0;
- v[NMAX - 1].currStep = 0;
- v[NMAX - 1].x = x;
- v[NMAX - 1].y = y;
- v[NMAX - 1].dir = 1;
- v[NMAX - 1].acc = 0;
- v[NMAX - 1].hp = 123123;
- vector<vector<int>> harta(NMAX, vector<int>(NMAX, 0));
- harta[v[NMAX - 1].y][v[NMAX - 1].x] = 1;
- while(v[NMAX - 1].updatePos(1)) harta[v[NMAX - 1].y][v[NMAX - 1].x] = 1;
- harta[v[NMAX - 1].y][v[NMAX - 1].x] = 1;
- return harta;
- }
- int main()
- {
- ios_base::sync_with_stdio(false);
- int i, x, y, dir, nr, q, t, id, rng;
- double hp, dmg;
- cin >> wx >> wy;
- cin >> x >> y;
- dir = 1;
- i = 0;
- string line;
- cin.get();
- getline(cin, line);
- istringstream iss(line);
- while(iss >> comm[i] >> step[i]) ++i;
- n = i;
- cin >> hp >> speed;
- cin >> nr;
- for(i = 0; i < nr; ++i) {
- cin >> spawnTime[i];
- toSpawn[spawnTime[i]].push_back(i);
- v[i].i = 0;
- v[i].currStep = 0;
- v[i].x = x;
- v[i].y = y;
- v[i].dir = 1;
- v[i].acc = 0;
- v[i].hp = hp;
- }
- vector<vector<int>> harta = getHarta(x, y);
- for (int i = 0; i < wy; ++i)
- for (int j = 0; j < wx; ++j)
- cout << harta[i][j] << " \n"[j == wy - 1];
- return 0;
- }
- /*
- 0 0 0 0 0 0 0 0 0 0
- 0 1 0 1 1 0 0 0 0 0
- 0 1 0 0 1 0 0 0 0 0
- 1 1 0 0 1 0 0 0 0 0
- 0 0 1 1 1 1 0 1 1 0
- 0 0 0 1 1 1 0 0 1 0
- 0 0 1 1 1 1 0 1 1 1
- 0 0 0 1 0 0 0 1 0 0
- 0 0 0 1 1 1 0 1 0 0
- 0 0 0 0 0 0 1 1 0 0
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement