Submission #1050347

#TimeUsernameProblemLanguageResultExecution timeMemory
1050347vjudge1Dango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms2440 KiB
/* author: CRISTIANO RONALDO #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set; can do: find_by_order, order_of_key __builtin_clz(x): the number of zeros at the beginning of the number __builtin_ctz(x): the number of zeros at the end of the number __builtin_popcount(x): the number of ones in the number __builtin_parity(x): the parity (even or odd) of the number of ones mt19937 rng(16); mt19937 bruh(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rofl(chrono::steady_clock::now().time_since_epoch().count()); */ #include <bits/stdc++.h> #define all(a) a.begin(), a.end() #define F first #define S second #define pb push_back #define lv v+v #define rv v+v+1 #define files freopen("aa.txt", "r", stdin), freopen("aa.txt", "w", stdout) using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pll = pair <long long, long long>; using pii = pair <int,int>; #pragma GCC optimize("unroll-loops") #pragma GCC optimize("O3") long long mod = 998244353; const ll N = 3e3 + 10; const ll M = 7e3 + 10; const ll P = 311; const ld EPS = 1e-7; const ll block = 450; const ll inf = 2e18; ll n,m,ans; char a[N][N]; bool used[N][N]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin>>n>>m; for(ll i = 1; i<=n; i++) { for(ll j = 1; j<=m; j++) { cin>>a[i][j]; } } for(ll i = n; i>0; i--) { for(ll j = m; j>m-2; j--) { if(a[i][j] == 'R' && !used[i][j] && a[i][j+1] == 'G' && !used[i][j+1] && a[i][j+2] == 'W' && !used[i][j+2]) { ans++; used[i][j] = used[i][j+1] = used[i][j+2] = true; } } } for(ll i = n; i>n-2; i--) { for(ll j = m; j>0; j--) { if(a[i][j] == 'R' && !used[i][j] && a[i+1][j] == 'G' && !used[i+1][j] && a[i+2][j] == 'W' && !used[i+2][j]) { ans++; used[i][j] = used[i+1][j] = used[i+2][j] = true; } else if(a[i][j] == 'R' && !used[i][j] && a[i][j+1] == 'G' && !used[i][j+1] && a[i][j+2] == 'W' && !used[i][j+2]) { ans++; used[i][j] = used[i][j+1] = used[i][j+2] = true; } } } for(ll i = n; i>0; i--) { for(ll j = m; j>0; j--) { if(a[i][j] == 'R' && !used[i][j] && a[i+1][j] == 'G' && !used[i+1][j] && a[i+2][j] == 'W' && !used[i+2][j]) { ans++; used[i][j] = used[i+1][j] = used[i+2][j] = true; } else if(a[i][j] == 'R' && !used[i][j] && a[i][j+1] == 'G' && !used[i][j+1] && a[i][j+2] == 'W' && !used[i][j+2]) { ans++; used[i][j] = used[i][j+1] = used[i][j+2] = true; } } } cout<<ans; return 0; } // equal, min, max, 1, random, build /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...