Submission #1163632

#TimeUsernameProblemLanguageResultExecution timeMemory
1163632hainam2k9Dango Maker (JOI18_dango_maker)C++20
13 / 100
1 ms400 KiB
#include <bits/stdc++.h>
#define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0)
#define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define db long double
#define sz(a) ((int)(a).size())
#define pb emplace_back
#define pf emplace_front
#define pob pop_back
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define ins emplace
#define mp make_pair
using namespace std;
const int MOD = 1e9+7, MAXN = 1e5+5;
const string NAME = "";
int n,m,rs=0;
char c[3005][3005];
bool ok[3005][3005];
int main()
{
    tt;
    if(fopen((NAME + ".INP").c_str(), "r")) fo;
    cin >> n >> m;
    for(int i = 1; i<=n; ++i)
        for(int j = 1; j<=m; ++j)
            cin >> c[i][j];
    for(int i = 1; i<=n; ++i)
        for(int j = 1; j<=m; ++j){
            if(c[i][j]!='R') continue;
            if(j<=m-2&&c[i][j+1]=='G'&&c[i][j+2]=='W'&&!ok[i][j+1]&&!ok[i][j+2]) ++rs, ok[i][j+1]=ok[i][j+2]=1;
            else if(i<=n-2&&c[i+1][j]=='G'&&c[i+2][j]=='W'&&!ok[i+1][j]&&!ok[i+2][j]){
                if(j>2&&c[i+1][j+1]=='W'&&c[i+1][j-1]=='R'&&c[i+2][j-1]=='G'&&c[i+2][j-2]=='R') continue;
                ++rs, ok[i+1][j]=ok[i+2][j]=1;
            }
        }
    cout << rs;
}

Compilation message (stderr)

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:3:19: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dango_maker.cpp:28:45: note: in expansion of macro 'fo'
   28 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
dango_maker.cpp:3:63: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |                                                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dango_maker.cpp:28:45: note: in expansion of macro 'fo'
   28 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...