제출 #1057621

#제출 시각아이디문제언어결과실행 시간메모리
1057621manhlinh1501Dango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms10844 KiB
#include <bits/stdc++.h> using namespace std; using i64 = long long; const int MAXN = 3e3 + 5; int N, M; char a[MAXN][MAXN]; bool vis[MAXN][MAXN]; signed main() { #define TASK "code" if (fopen(TASK ".inp", "r")) { freopen(TASK ".inp", "r", stdin); freopen(TASK ".out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> M; for(int i = 1; i <= N; i++) { for(int j = 1; j <= M; j++) cin >> a[i][j]; } memset(vis, true, sizeof vis); int ans = 0; for(int i = 1; i <= N; i++) { for(int j = 1; j <= M; j++) { if(a[i][j] == 'R') { if(a[i + 1][j] == 'G' and a[i + 2][j] == 'W' and vis[i][j] and vis[i + 1][j] and vis[i + 2][j]) { ans++; vis[i][j] = vis[i + 1][j] = vis[i + 2][j] = false; } else if(a[i][j + 1] == 'G' and a[i][j + 2] == 'W' and vis[i][j] and vis[i][j + 1] and vis[i][j + 2]) { ans++; vis[i][j] = vis[i][j + 1] = vis[i][j + 2] = false; } } } } cout << ans; return (0 ^ 0); }

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

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen(TASK ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
dango_maker.cpp:15:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         freopen(TASK ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...