This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
#define sz size()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//===================//
// Added libraries //
//===================//
//===================//
//end added libraries//
//===================//
void program();
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
program();
}
//===================//
// begin program //
//===================//
const int MX = 4000;
int n, m;
char gr[MX][MX];
string cur;
void program() {
cin>>n>>m;
RE(i,n) RE(j,m) cin>>gr[i][j];
int ans = 0;
RE(i,n) {
cur = "";
RE(j,m) {
cur += gr[i][j];
if(cur.size() > 3) cur.erase(cur.begin());
if(cur == "RGW") {
RE(k,3) gr[i][j-k] = 'X';
ans++;
}
}
}
RE(j,m) {
cur = "";
RE(i,n) {
cur += gr[i][j];
if(cur.size() > 3) cur.erase(cur.begin());
if(cur == "RGW") {
RE(k,3) gr[i-k][j] = 'X';
ans++;
}
}
}
cout<<ans<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |