QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#835852 | #9926. Flipping Paths | ucup-team055# | AC ✓ | 9ms | 4168kb | C++20 | 4.2kb | 2024-12-28 15:04:25 | 2024-12-28 15:04:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll ILL=2167167167167167167;
const int INF=2100000000;
#define rep(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define all(p) p.begin(),p.end()
template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> ll LB(vector<T> &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> ll UB(vector<T> &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> bool chmin(T &a,T b){if(b<a){a=b;return 1;}else return 0;}
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return 1;}else return 0;}
template<class T> void So(vector<T> &v) {sort(v.begin(),v.end());}
template<class T> void Sore(vector<T> &v) {sort(v.begin(),v.end(),[](T x,T y){return x>y;});}
bool yneos(bool a,bool upp=0){if(a){cout<<(upp?"YES\n":"Yes\n");}else{cout<<(upp?"NO\n":"No\n");}return a;}
template<class T> void vec_out(vector<T> &p,int ty=0){
if(ty==2){cout<<'{';for(int i=0;i<(int)p.size();i++){if(i){cout<<",";}cout<<'"'<<p[i]<<'"';}cout<<"}\n";}
else{if(ty==1){cout<<p.size()<<"\n";}for(int i=0;i<(int)(p.size());i++){if(i) cout<<" ";cout<<p[i];}cout<<"\n";}}
template<class T> T vec_min(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmin(ans,x);return ans;}
template<class T> T vec_max(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmax(ans,x);return ans;}
template<class T> T vec_sum(vector<T> &a){T ans=T(0);for(auto &x:a) ans+=x;return ans;}
int pop_count(long long a){int res=0;while(a){res+=(a&1),a>>=1;}return res;}
void solve();
// CITRUS CURIO CITY / FREDERIC
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
cin >> t;
rep(i, 0, t) solve();
}
void solve(){
int N, M;
cin >> N >> M;
vector p(N, vector<int>(M));
vector A(2, vector<int>(N + M - 1));
rep(i, 0, N) rep(j, 0, M){
char c;
cin >> c;
if (c == 'B') p[i][j]++;
A[p[i][j]][i + j] ^= 1;
}
// fin is all 0
int ok = 0;
rep(i, 0, 2){
if (vec_min(A[i]) == vec_max(A[i])){
if (i == 0){
rep(a, 0, N) rep(j, 0, M) p[a][j] ^= 1;
}
ok = 1;
break;
}
}
if (ok == 0){
cout << "NO\n";
return;
}
vector<string> ans;
int x = 0, y = 0;
string tmp;
auto addx = [&](int a = 1) -> void {
x++;
p[x][y] ^= a;
tmp += 'D';
};
auto addy = [&](int a = 1) -> void {
y++;
p[x][y] ^= a;
tmp += 'R';
};
auto pus = [&]() -> void {
ans.push_back(tmp);
// cout << tmp << endl;
tmp = "";
// rep(i, 0, N) vec_out(p[i]);
};
string base;
while (x != N - 1 || y != M - 1){
if (x == N - 1) addy(0);
else if (y == M - 1) addx(0);
else if (x == y) addy(0);
else addx(0);
}
base = tmp;
tmp = "";
// diff = x - y
for (int diff = N - 1; diff > 0; diff--){
x = 0, y = 0;
p[0][0] ^= 1;
while (x != N - 1 || y != M - 1){
if (x == N - 1) addy();
else if (y == M - 1) addx();
else if (x - y == diff) addy();
else if (x - y < diff - 1) addx();
else if (p[x + 1][y] == 1) addx();
else addy();
}
pus();
}
for (int diff = 1 - M; diff < -1; diff++){
x = 0, y = 0;
p[0][0] ^= 1;
while (x != N - 1 || y != M - 1){
if (x == N - 1) addy();
else if (y == M - 1) addx();
else if (x - y == diff) addx();
else if (x - y > diff + 1) addy();
else if (p[x][y + 1] == 1) addy();
else addx();
}
pus();
}
if (p[0][0]){
ans.push_back(base);
x = 0, y = 0;
p[0][0] ^= 1;
for (auto c : base){
if (c == 'D') x++;
else y++;
p[x][y] ^= 1;
}
}
cout << "YES\n";
cout << ans.size() << "\n";
for (auto z : ans) cout << z << "\n";
// rep(i, 0, N) rep(j, 0, M) assert(p[i][j] == 0);
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
4 3 3 WBB BWB BBW 1 5 WWWWW 2 2 BB BB 4 1 W B B W
output:
YES 4 DDRR RDRD RRDD RDRD YES 3 RRRR RRRR RRRR YES 2 RD RD NO
result:
ok ok (4 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
323 1 2 BB 1 2 BW 1 2 WB 1 2 WW 2 1 B B 2 1 B W 2 1 W B 2 1 W W 1 3 BBB 1 3 BBW 1 3 BWB 1 3 BWW 1 3 WBB 1 3 WBW 1 3 WWB 1 3 WWW 2 2 BB BB 2 2 BB BW 2 2 BB WB 2 2 BB WW 2 2 BW BB 2 2 BW BW 2 2 BW WB 2 2 BW WW 2 2 WB BB 2 2 WB BW 2 2 WB WB 2 2 WB WW 2 2 WW BB 2 2 WW BW 2 2 WW WB 2 2 WW WW 3 1 B B B 3 ...
output:
YES 0 NO NO YES 1 R YES 2 D D NO NO YES 1 D YES 2 RR RR NO NO NO NO NO NO YES 1 RR YES 2 RD RD NO YES 1 RD NO YES 1 DR NO YES 2 DR RD NO NO YES 2 DR RD NO YES 1 DR NO YES 1 RD NO YES 2 RD RD YES 2 DD DD NO NO NO NO NO NO YES 3 DD DD DD YES 2 RRR RRR NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 3 RR...
result:
ok ok (323 test cases)
Test #3:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
278 2 4 BWBW WWBB 2 4 BWBW WWBW 2 4 BWBW WWWB 2 4 BWBW WWWW 2 4 BWWB BBBB 2 4 BWWB BBBW 2 4 BWWB BBWB 2 4 BWWB BBWW 2 4 BWWB BWBB 2 4 BWWB BWBW 2 4 BWWB BWWB 2 4 BWWB BWWW 2 4 BWWB WBBB 2 4 BWWB WBBW 2 4 BWWB WBWB 2 4 BWWB WBWW 2 4 BWWB WWBB 2 4 BWWB WWBW 2 4 BWWB WWWB 2 4 BWWB WWWW 2 4 BWWW BBBB 2 ...
output:
NO NO NO NO NO NO YES 3 DRRR RRRD RRDR NO NO NO NO NO NO NO NO NO YES 4 DRRR RRDR RDRR RDRR NO NO NO YES 3 DRRR RRDR RRDR NO NO NO NO NO NO NO NO NO NO NO NO NO YES 4 DRRR RRRD RDRR RDRR NO NO YES 4 DRRR RRRD RDRR RDRR NO NO NO NO NO NO NO NO NO NO NO NO NO YES 3 DRRR RRDR RRDR NO NO NO YES 4 DRRR R...
result:
ok ok (278 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
333 3 3 BBW WWB BWB 3 3 BBW WWB BWW 3 3 BBW WWB WBB 3 3 BBW WWB WBW 3 3 BBW WWB WWB 3 3 BBW WWB WWW 3 3 BBW WWW BBB 3 3 BBW WWW BBW 3 3 BBW WWW BWB 3 3 BBW WWW BWW 3 3 BBW WWW WBB 3 3 BBW WWW WBW 3 3 BBW WWW WWB 3 3 BBW WWW WWW 3 3 BWB BBB BBB 3 3 BWB BBB BBW 3 3 BWB BBB BWB 3 3 BWB BBB BWW 3 3 BWB ...
output:
YES 3 DDRR DRDR RDRD NO NO NO NO NO YES 3 DDRR DRRD RDRD NO NO NO NO NO NO NO NO NO YES 3 DDRR RDDR RRDD NO NO NO NO NO YES 3 DDRR RDRD RRDD NO NO NO NO NO NO NO NO NO NO NO NO NO YES 3 DRDR RDDR RRDD NO NO NO NO NO YES 3 DRDR RDRD RRDD NO NO NO YES 4 DRDR RDDR RDRD RDRD NO NO NO NO NO NO NO NO NO Y...
result:
ok ok (333 test cases)
Test #5:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
266 3 3 WWB WWW WWW 3 3 WWW BBB BBB 3 3 WWW BBB BBW 3 3 WWW BBB BWB 3 3 WWW BBB BWW 3 3 WWW BBB WBB 3 3 WWW BBB WBW 3 3 WWW BBB WWB 3 3 WWW BBB WWW 3 3 WWW BBW BBB 3 3 WWW BBW BBW 3 3 WWW BBW BWB 3 3 WWW BBW BWW 3 3 WWW BBW WBB 3 3 WWW BBW WBW 3 3 WWW BBW WWB 3 3 WWW BBW WWW 3 3 WWW BWB BBB 3 3 WWW ...
output:
NO NO NO NO YES 3 DRDR DRRD RRDD NO NO NO NO NO YES 3 DRDR DRDR RRDD NO NO NO NO NO NO NO NO NO NO NO NO NO YES 3 DDRR DRRD RRDD NO NO NO NO NO YES 3 DDRR DRDR RRDD NO NO NO YES 4 DDRR DRRD RDRD RDRD NO NO NO NO NO NO NO NO NO YES 4 DDRR DRDR RDRD RDRD NO NO NO NO NO NO NO NO NO YES 4 DRDR DRRD RDRD...
result:
ok ok (266 test cases)
Test #6:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
245 4 2 WW BB WB BW 4 2 WW BB WB WB 4 2 WW BB WB WW 4 2 WW BB WW BB 4 2 WW BB WW BW 4 2 WW BB WW WB 4 2 WW BB WW WW 4 2 WW BW BB BB 4 2 WW BW BB BW 4 2 WW BW BB WB 4 2 WW BW BB WW 4 2 WW BW BW BB 4 2 WW BW BW BW 4 2 WW BW BW WB 4 2 WW BW BW WW 4 2 WW BW WB BB 4 2 WW BW WB BW 4 2 WW BW WB WB 4 2 WW B...
output:
NO NO YES 3 DDDR DRDD RDDD NO YES 3 DDRD DRDD RDDD NO NO NO NO NO YES 3 DDDR DDRD RDDD NO YES 3 DDRD DDRD RDDD NO NO NO NO NO NO NO NO NO NO NO YES 4 DDDR DRDD RDDD RDDD NO NO NO NO NO YES 4 DDRD DRDD RDDD RDDD NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 4 DDDR DDRD RDDD RDDD NO NO NO NO ...
result:
ok ok (245 test cases)
Test #7:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
200 5 3 BBB BBB WBW BBW BBW 5 3 BBB BBB WBW BBW BWB 5 3 BBB BBB WBW BBW BWW 5 3 BBB BBB WBW BBW WBB 5 3 BBB BBB WBW BBW WBW 5 3 BBB BBB WBW BBW WWB 5 3 BBB BBB WBW BBW WWW 5 3 BBB BBB WBW BWB BBB 5 3 BBB BBB WBW BWB BBW 5 3 BBB BBB WBW BWB BWB 5 3 BBB BBB WBW BWB BWW 5 3 BBB BBB WBW BWB WBB 5 3 BBB ...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok ok (200 test cases)
Test #8:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
200 5 4 BWWB WBWW WBWW WBWW WBBW 5 4 BWWB WBWW WBWW WBWW WBWB 5 4 BWWB WBWW WBWW WBWW WBWW 5 4 BWWB WBWW WBWW WBWW WWBB 5 4 BWWB WBWW WBWW WBWW WWBW 5 4 BWWB WBWW WBWW WBWW WWWB 5 4 BWWB WBWW WBWW WBWW WWWW 5 4 BWWB WBWW WBWW WWBB BBBB 5 4 BWWB WBWW WBWW WWBB BBBW 5 4 BWWB WBWW WBWW WWBB BBWB 5 4 BW...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 6 DDDDRRR DDRDRDR DDRRDRD RDRDRDD RRDRDDD RDRDRDD NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 6 DDDDRRR DDRDRDR DDRRDDR RDRDRDD RRDRDDD RDRDRDD NO NO NO NO NO NO NO NO NO YES 6 DDDDRRR DDRDDRR DDRRDRD RDRDRDD RRDRDDD RDRDRDD NO ...
result:
ok ok (200 test cases)
Test #9:
score: 0
Accepted
time: 8ms
memory: 4168kb
input:
5 200 200 WBWW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RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...
result:
ok ok (5 test cases)
Test #14:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
100 18 3 BBB BWW WWB BWB WWW WBW WBB WBW BWW BWB BBB BBW BWW BWB BBW BBW WWB BBB 33 19 BBBBWWBWWBWBBBWWWWB BBWWBWBBBBBWWBBBWBB BBBWWBBBWBWBBWBBWBB WWWBWWWBWBBWBBBBWBB WBBBWWWBWWWBWBBWBBW WWWBBBWWBBBWBWBBBWW WWBBWWWWBWBBBBWWWBW BWWBBWWBBWBBBWBWBWB BWWWBBBBWBBWBWWWBBW BWBBBBBWBBBWBWBWBWW BBBBWBWBBBBWB...
output:
YES 18 DDDDDDDDDDDDDDDDRDR DDDDDDDDDDDDDDDRDDR DDDDDDDDDDDDDDRDDRD DDDDDDDDDDDDDDRRDDD DDDDDDDDDDDDRDRDDDD DDDDDDDDDDDDRRDDDDD DDDDDDDDDDRDDRDDDDD DDDDDDDDDDRDRDDDDDD DDDDDDDDRDRDDDDDDDD DDDDDDDDRRDDDDDDDDD DDDDDDDRDRDDDDDDDDD DDDDDRDDRDDDDDDDDDD DDDDDRDRDDDDDDDDDDD DDDRDRDDDDDDDDDDDDD DDRDRDDDDDDDD...
result:
ok ok (100 test cases)
Test #15:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
50 1 14 BBBBBBBBBBBBBB 15 3 WWW WBB BBB WWB BBB WBB WWW BBW BWB WBW WWW WBB BBB WWB BBW 3 19 WBWBBBWWBBWBWBWBBWB BBBWWWBWBBWWBBWBBWW BWBBWBBWBBWWBBWBBWW 77 21 WWWBBBBBWBWBWBWWWWWWW WBBWBBBWWBBWBWBWWWWBW BBBWBWWWWWWWWBWBWBBBW BWBBBWBWWWWBBBWBBBBWW WBBWWWBWWBWWBWWBBBBWB WWWBBBWBBWBBBBBBWBWBB BWWWWWBWW...
output:
YES 12 RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR YES 16 DDDDDDDDDDDDDDRR DDDDDDDDDDDDDRRD DDDDDDDDDDDDRDRD DDDDDDDDDDDRRDDD DDDDDDDDDRDRDDDD DDDDDDDDDRDRDDDD DDDDDDDDRDRDDDDD...
result:
ok ok (50 test cases)
Test #16:
score: 0
Accepted
time: 4ms
memory: 4024kb
input:
10 2 23 BBWWBBWWWBWBWBBWBBBWWBW BWWBBWWWBWBWBBWBBBWWBWB 87 44 BBWBWBWBWWWWWWBWWBBBWBBBBWWWWBBBBBBWBWWWWBWW BBWBBBWBWBWBBWWBBBWWBWWWWBWBBBBWWWWBBBBBWBWW WBWBBWBWBBBWBWWWBBBBWWBWBWWBWBWWWWWBBBWWBBWB WBWWWWWWBWWWBBBBBWBBBWBBWWWBBBBBBBWWWWWWWWWB BWBWWBBWBBBBBBBBWBBBWBBWWBBBBBWBWBWBBWWBWBWW BBBWBBBBBBWWB...
output:
YES 22 RDRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRRRRRRRRRRRRRD RRRRRRRRRRRRRRRRRRRRRDR RRRRRRRRRRRRRRRRRRRRDRR RRRRRRRRRRRRRRRRRRDRRRR RRRRRRRRRRRRRRRRRDRRRRR RRRRRRRRRRRRRRRRRDRRRRR RRRRRRRRRRRRRRRDRRRRRRR RRRRRRRRRRRRRRDRRRRRRRR RRRRRRRRRRRRRDRRRRRRRRR RRRRRRRRRRRRRDRRRRRRRRR RRRRRRRRRRRRDRRRRRRRRRR RRRRR...
result:
ok ok (10 test cases)
Extra Test:
score: 0
Extra Test Passed