제출 #1094141

#제출 시각아이디문제언어결과실행 시간메모리
1094141thangdz2k7Furniture (JOI20_furniture)C++17
100 / 100
176 ms12884 KiB
// author : thembululquaUwU // 3.9.2024 #include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define endl '\n' using namespace std; using ll = long long; using ii = pair <int, int>; using vi = vector <int>; const int N = 1e3 + 5; const int mod = 1e9 + 7; void maxl(auto &a, auto b) {a = max(a, b);} void minl(auto &a, auto b) {a = min(a, b);} bool blocked[N][N]; int n, m, f[N + N]; void block(int x, int y){ f[x + y] --; blocked[x][y] = true; if (blocked[x - 1][y + 1]) { if (!blocked[x][y + 1]) block(x, y + 1); if (!blocked[x - 1][y]) block(x - 1, y); } if (blocked[x + 1][y - 1]) { if (!blocked[x + 1][y]) block(x + 1, y); if (!blocked[x][y - 1]) block(x, y - 1); } } void solve(){ cin >> n >> m; for (int i = 0; i <= m + 1; ++ i) blocked[0][i] = true, blocked[n + 1][i] = true; for (int i = 0; i <= n + 1; ++ i) blocked[i][0] = true, blocked[i][m + 1] = true; for (int i = 1; i <= n; ++ i) for (int j = 1; j <= m; ++ j) ++ f[i + j]; for (int i = 1; i <= n; ++ i) for (int j = 1; j <= m; ++ j){ int a; cin >> a; if (a && !blocked[i][j]) block(i, j); } int q; cin >> q; while (q --){ int x, y; cin >> x >> y; if (blocked[x][y]) { cout << 1 << endl; continue; } if (f[x + y] == 1){ cout << 0 << endl; continue; } cout << 1 << endl; block(x, y); } } int main(){ if (fopen("pqh.inp", "r")){ freopen("pqh.inp", "r", stdin); freopen("pqh.out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; while (t --) solve(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

furniture.cpp:18:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   18 | void maxl(auto &a, auto b) {a = max(a, b);}
      |           ^~~~
furniture.cpp:18:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   18 | void maxl(auto &a, auto b) {a = max(a, b);}
      |                    ^~~~
furniture.cpp:19:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void minl(auto &a, auto b) {a = min(a, b);}
      |           ^~~~
furniture.cpp:19:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void minl(auto &a, auto b) {a = min(a, b);}
      |                    ^~~~
furniture.cpp: In function 'int main()':
furniture.cpp:62:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   62 |         freopen("pqh.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
furniture.cpp:63:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |         freopen("pqh.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...