Submission #757089

#TimeUsernameProblemLanguageResultExecution timeMemory
757089qwertyqwertyDango Maker (JOI18_dango_maker)C++17
0 / 100
3 ms340 KiB
// stars only shine in darkness #include <bits/stdc++.h> // date:12-06-2023 21:32:47 using namespace std; #define retardlord ios_base::sync_with_stdio(NULL), cin.tie(NULL); #define task freopen("dangomaker.inp", "r", stdin), freopen("dangomaker.out", "w", stdout); const int N = 3e3 + 1; int n, m; char a[N][N]; int f[3], f1[3]; //-------------------------------------------------------------------------------------------------- void nhap() { cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin >> a[i][j]; } //-------------------------------------------------------------------------------------------------- void xuly() { int ans = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (a[i][j] == 'G') { f1[0] = f1[1] = f1[2] = -1e7; f1[0] = max({f[0], f[1], f[2]}); if (j - 1 >= 1 && j + 1 <= m && a[i][j - 1] == 'R' && a[i][j + 1] == 'W') f1[1] = max(f[0], f[1]) + 1; if (i - 1 >= 1 && i + 1 <= n && a[i - 1][j] == 'R' && a[i + 1][j] == 'W') f1[2] = max(f[0], f[2]) + 1; f[0] = f1[0], f[1] = f1[1], f[2] = f1[2]; } else { f[0] = max({f[0], f[1], f[2]}); f[1] = f[2] = -1e7; } } } ans += max({f[0], f[1], f[2]}); cout << ans; } //-------------------------------------------------------------------------------------------------- signed main() { retardlord; #ifndef ONLINE_JUDGE task; #endif nhap(); xuly(); return 0; } //--------------------------------------------------------------------------------------------------

Compilation message (stderr)

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:7:21: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define task freopen("dangomaker.inp", "r", stdin), freopen("dangomaker.out", "w", stdout);
      |              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dango_maker.cpp:54:5: note: in expansion of macro 'task'
   54 |     task;
      |     ^~~~
dango_maker.cpp:7:60: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define task freopen("dangomaker.inp", "r", stdin), freopen("dangomaker.out", "w", stdout);
      |                                                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dango_maker.cpp:54:5: note: in expansion of macro 'task'
   54 |     task;
      |     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...