Submission #900485

#TimeUsernameProblemLanguageResultExecution timeMemory
900485qinCell Automaton (JOI23_cell)C++17
4 / 100
13 ms1884 KiB
#include <bits/stdc++.h> #define fi first #define se second #define ssize(x) int(x.size()) #define pn printf("\n"); using namespace std; typedef long long ll; typedef pair<int, int> pii; int inf = 2e09; ll infll = 2e18; int mod = 119<<23|1; void answer(){ int n, q; scanf("%d%d", &n, &q); vector<vector<int>> t(300, vector<int>(300, 0)), templat = t, tmp; int x, y; for(int i = 1; i <= n; ++i) scanf("%d%d", &x, &y), x += 100, y += 100, t[x][y] = 2; vector<int> result(51); result[0] = n; for(int T = 1; T <= 50; ++T){ tmp = templat; int cnt = 0; for(int i = 1; i < 300-1; ++i) for(int j = 1; j < 300-1; ++j) if(!t[i][j] && (t[i+1][j]==2 || t[i-1][j]==2 || t[i][j+1]==2 || t[i][j-1]==2)) tmp[i][j] = 2, ++cnt; else if(t[i][j] == 1) tmp[i][j] = 0; else if(t[i][j] == 2) tmp[i][j] = 1; t = tmp; //~ for(int i = 80; i < 120; ++i){ //~ for(int j = 80; j < 120; ++j) if(t[i][j] == 2) printf("#"); //~ else if(t[i][j] == 1) printf("."); //~ else printf(" "); //~ pn; //~ } //~ usleep(300000); //~ for(int i = 0; i < 4; ++i) pn; result[T] = cnt; } for(++q; --q; ){ int T; scanf("%d", &T); printf("%d\n", result[T]); } } signed main(){ int T = 1; for(++T; --T; ) answer(); return 0; }

Compilation message (stderr)

cell.cpp: In function 'void answer()':
cell.cpp:11:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   int n, q; scanf("%d%d", &n, &q);
      |             ~~~~~^~~~~~~~~~~~~~~~
cell.cpp:14:36: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   for(int i = 1; i <= n; ++i) scanf("%d%d", &x, &y), x += 100, y += 100, t[x][y] = 2;
      |                               ~~~~~^~~~~~~~~~~~~~~~
cell.cpp:36:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |     int T; scanf("%d", &T);
      |            ~~~~~^~~~~~~~~~
#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...