제출 #1202567

#제출 시각아이디문제언어결과실행 시간메모리
1202567jahongirDango Maker (JOI18_dango_maker)C++20
13 / 100
0 ms328 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template<typename T> using ordered_set = tree<T,null_type,less_equal<T>,rb_tree_tag, tree_order_statistics_node_update>; #define ll long long #define pi pair<int,int> #define vi vector<int> #define pb push_back #define all(a) a.begin(),a.end() void solve(){ int n,m; cin >> n >> m; int cnt = 0; vector<char> last(m,'B'), now(m); int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++) cin >> now[j]; for(int j = 0; j < m-2; j++){ if(now[j]=='R' && now[j+1]=='G' && now[j+2]=='W'){ ans++; now[j] = now[j+1] = now[j+2] = 'B'; } } for(int j = 0; j < m; j++){ if(now[j]=='W' && last[j]=='G') last[j] = 'B', ans++; else if(now[j]=='G' && last[j]=='R') last[j] = 'G'; else if(now[j]=='R') last[j] = 'R'; else last[j] = 'B'; } } cout << ans << '\n'; } signed main(){ cin.tie(0)->sync_with_stdio(0); int t = 1; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...