제출 #1190555

#제출 시각아이디문제언어결과실행 시간메모리
1190555DedibeatCell Automaton (JOI23_cell)C++20
4 / 100
8077 ms413464 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) { return os << "(" << p.first << "," << p.second << ")"; } template<typename T> void print(T v) { for(auto x : v) cout << x << " "; cout << "\n"; } int main() { int N, Q; cin >> N >> Q; set<pair<int, int>> black, gray; for(int i = 0; i < N; i++) { int x, y; cin >> x >> y; black.insert({x, y}); } vector<int> ans(1005, 0); for(int i = 0; i <= 50; i++) { // cout << "at " << i << "\n"; // print(black); // print(gray); ans[i] = black.size(); set<pair<int, int>> tmp1, tmp2; for(auto [x, y] : black) { if(!gray.count({x - 1, y}) && !black.count({x - 1, y})) tmp1.insert({x - 1, y}); if(!gray.count({x + 1, y}) && !black.count({x + 1, y})) tmp1.insert({x + 1, y}); if(!gray.count({x, y - 1}) && !black.count({x, y - 1})) tmp1.insert({x, y - 1}); if(!gray.count({x, y + 1}) && !black.count({x, y + 1})) tmp1.insert({x, y + 1}); tmp2.insert({x, y}); } black = tmp1; gray = tmp2; } for(int i = 0; i < Q; i++) { int x; cin >> x; cout << ans[x] << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...