QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#836568 | #9926. Flipping Paths | ucup-team159# | AC ✓ | 11ms | 4356kb | C++20 | 3.8kb | 2024-12-29 00:46:39 | 2024-12-29 00:46:40 |
Judging History
answer
#line 1 "L.cpp"
// #pragma GCC target("avx2,avx512f,avx512vl,avx512bw,avx512dq,avx512cd,avx512vbmi,avx512vbmi2,avx512vpopcntdq,avx512bitalg,bmi,bmi2,lzcnt,popcnt")
// #pragma GCC optimize("Ofast")
#line 2 "/home/sigma/comp/library/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb push_back
#define eb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> bool chmax(T& x, U y){
if(x<y){ x=y; return true; }
return false;
}
template<class T,class U> bool chmin(T& x, U y){
if(y<x){ x=y; return true; }
return false;
}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class T> int lwb(const V<T>& v, const T& a){return lower_bound(all(v),a) - v.begin();}
template<class T>
V<T> Vec(size_t a) {
return V<T>(a);
}
template<class T, class... Ts>
auto Vec(size_t a, Ts... ts) {
return V<decltype(Vec<T>(ts...))>(a, Vec<T>(ts...));
}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
o<<"{";
for(const T& v:vc) o<<v<<",";
o<<"}";
return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }
#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
os<<t<<" ~ ";
dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {"; \
for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif
template<class D> D divFloor(D a, D b){
return a / b - (((a ^ b) < 0 && a % b != 0) ? 1 : 0);
}
template<class D> D divCeil(D a, D b) {
return a / b + (((a ^ b) > 0 && a % b != 0) ? 1 : 0);
}
#line 5 "L.cpp"
void solve(){
int H,W; cin >> H >> W;
VV<int> A_(H,V<int>(W));
rep(i,H){
string t; cin >> t;
rep(j,W) if(t[j] == 'B') A_[i][j] = 1;
}
rep(_,2){
auto A = A_;
if(_){
rep(i,H) rep(j,W) A[i][j] ^= 1;
}
V<string> ans;
rep(t,H+W-1){
show("-----------");
show(t);
string s;
int x = 0, y = 0;
show(A);
A[0][0] ^= 1;
rep(h,H-1){
// t = h-w + (W-1)
int w = h-t+(W-1);
shows(h,w);
shows(x,y);
if(w<0 || w>=W || A[h][w] == 0){
s += 'D'; x++; A[x][y] ^= 1;
continue;
}
assert(y <= w);
while(y != w){
s += 'R'; y++; A[x][y] ^= 1;
}
s += 'D'; x++; A[x][y] ^= 1;
}
assert(x == H-1);
while(y != W-1){
s += 'R'; y++; A[x][y] ^= 1;
}
ans.pb(s);
}
show(A);
if(A[0][0]){
A[0][0] ^= 1;
int x = 0, y = 0;
string s;
rep(h,H-1){
s += 'D'; x++; A[x][y] ^= 1;
}
rep(w,W-1){
s += 'R'; y++; A[x][y] ^= 1;
}
ans.pb(s);
}
bool ok = true;
rep(i,H) rep(j,W) if(A[i][j]) ok = false;
if(ok){
cout << "YES\n";
cout << ans.size() << endl;
for(auto s: ans) cout << s << endl;
return;
}
}
cout << "NO\n";
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false); //DON'T USE scanf/printf/puts !!
cout << fixed << setprecision(20);
int T; cin >> T;
while(T--) solve();
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3604kb
input:
4 3 3 WBB BWB BBW 1 5 WWWWW 2 2 BB BB 4 1 W B B W
output:
YES 6 RRDD DDRR DDRR DDRR DDRR DDRR YES 6 RRRR RRRR RRRR RRRR RRRR RRRR YES 4 DR DR DR DR NO
result:
ok ok (4 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3624kb
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 3 R R R NO NO YES 2 R R YES 3 D D D NO NO YES 2 D D YES 3 RR RR RR NO NO NO NO NO NO YES 4 RR RR RR RR YES 4 DR DR DR DR NO YES 3 RD DR DR NO YES 3 DR DR DR NO YES 4 RD DR DR DR NO NO YES 4 RD DR DR DR NO YES 3 DR DR DR NO YES 3 RD DR DR NO YES 4 DR DR DR DR YES 3 DD DD DD NO NO NO NO NO NO YES ...
result:
ok ok (323 test cases)
Test #3:
score: 0
Accepted
time: 1ms
memory: 3600kb
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 5 RRRD RRDR DRRR DRRR DRRR NO NO NO NO NO NO NO NO NO YES 6 DRRR RRDR DRRR DRRR DRRR DRRR NO NO NO YES 5 DRRR DRRR DRRR DRRR DRRR NO NO NO NO NO NO NO NO NO NO NO NO NO YES 6 RRRD DRRR DRRR DRRR DRRR DRRR NO NO YES 6 RRRD DRRR DRRR DRRR DRRR DRRR NO NO NO NO NO NO NO NO NO NO N...
result:
ok ok (278 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3492kb
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 5 DDRR RDRD DRDR DDRR DDRR NO NO NO NO NO YES 5 DDRR RDDR DRDR DDRR DDRR NO NO NO NO NO NO NO NO NO YES 5 RRDD RDDR DDRR DDRR DDRR NO NO NO NO NO YES 5 RRDD RDRD DDRR DDRR DDRR NO NO NO NO NO NO NO NO NO NO NO NO NO YES 5 RRDD RDDR DRDR DDRR DDRR NO NO NO NO NO YES 5 RRDD RDRD DRDR DDRR DDRR NO ...
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 5 RRDD DRRD DRDR DDRR DDRR NO NO NO NO NO YES 5 RRDD DDRR DDRR DDRR DDRR NO NO NO NO NO NO NO NO NO NO NO NO NO YES 5 RRDD DRRD DDRR DDRR DDRR NO NO NO NO NO YES 5 RRDD DDRR DRDR DDRR DDRR NO NO NO YES 6 DDRR DRRD DDRR DDRR DDRR DDRR NO NO NO NO NO NO NO NO NO YES 6 DDRR DDRR DRDR DD...
result:
ok ok (266 test cases)
Test #6:
score: 0
Accepted
time: 1ms
memory: 3536kb
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 5 RDDD DRDD DDDR DDDR DDDR NO YES 5 RDDD DRDD DDRD DDDR DDDR NO NO NO NO NO YES 5 RDDD DDDR DDRD DDDR DDDR NO YES 5 RDDD DDDR DDDR DDDR DDDR NO NO NO NO NO NO NO NO NO NO NO YES 6 DDDR DRDD DDDR DDDR DDDR DDDR NO NO NO NO NO YES 6 DDDR DRDD DDRD DDDR DDDR DDDR NO NO NO NO NO NO NO NO NO NO...
result:
ok ok (245 test cases)
Test #7:
score: 0
Accepted
time: 1ms
memory: 3828kb
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: 1ms
memory: 3572kb
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 8 DDDDRRR RRDRDDD DDDDRRR DDRRDRD DDRDRDR DDDDRRR DDDDRRR DDDDRRR NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 8 DDDDRRR RRDRDDD DDDDRRR DDRRDDR DDRDRDR DDDDRRR DDDDRRR DDDDRRR NO NO NO NO NO NO NO NO NO YES 8 DDDDRRR RRDRDDD DDD...
result:
ok ok (200 test cases)
Test #9:
score: 0
Accepted
time: 11ms
memory: 4356kb
input:
5 200 200 WBWWWBWBWWWWBWWWBBBBBBWBWWBWWBBWBWWBWBBBWBBWBBWBWBBWWWWWWBWWWBBWBWBWBWBBWBWWBWWBWBBBWWWBWBBWWBBBBBWWBBBBWWBBWBWWWBBWBWBWWWWBBWBWWBWWWWWBWWBBBBBWBBWBWWWWWBWWWBWBWWBBBBWWBWWWWBWBBWBWBBWWBWWBBWBWBWWBWBWB BBWBBBBBWBWWWWWWWWWWBBWWWWBWWBWWBBBBBWWWBWBWWBBWBBWWBBBBBWWBWBWBWWBWBWBBBBWWWWBWBBBBBWBBB...
output:
YES 400 RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...
result:
ok ok (5 test cases)
Test #10:
score: 0
Accepted
time: 3ms
memory: 4004kb
input:
5 200 200 WBWBWWBBBWWWWBWWWBBBBWWWWBWWBBBBWWBWWWWBWWBWWBWBBWBWWWWWWBBBWWWBWBBWBBBBBBWBBBWWBWBWBWWWWWWBBWBWWBWWBWWBWBBWBWBWWWWWBBWBWBWWWBWBBBBWWBBBBWWWWBBBBBWWWBBWWBBBBWWWBWBWBWWWBWBBWBBBBWWWWBWBWWBBBWBBBBWBBWWW BWBBWBWBWWBWWWBWBWBWBBWBWWWWWBBWBBWBBBWWBWBBBWWWBWWWBBBBWWWBBWWBBBWWBWBWWWWBBBWWBBWWBWWWB...
output:
YES 400 D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DDDDDDDDRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...
result:
ok ok (5 test cases)
Test #14:
score: 0
Accepted
time: 3ms
memory: 3576kb
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 20 DDDDDDDDDDDDDDDDDRR DRRDDDDDDDDDDDDDDDD DDRRDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDDDRR DDDRDRDDDDDDDDDDDDD DDDDDDDDDDDDDDDDDRR DDDDDDRRDDDDDDDDDDD DDDDDDRDRDDDDDDDDDD DDDDDDDRDDDDDDDDDDR DDDDDDDDDRRDDDDDDDD DDDDDDDDDRDDDDDDDDR DDDDDDDDDDDRRDDDDDD DDDDDDDDDDDRDDDDDDR DDDDDDDDDDDDDRRDDDD DDDDDDDDDDDDD...
result:
ok ok (100 test cases)
Test #15:
score: 0
Accepted
time: 4ms
memory: 3672kb
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 15 RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR RRRRRRRRRRRRR YES 18 DDDDDDDDDDDDDDRR DRRDDDDDDDDDDDDD DDDDDDDDDDDDDDRR DDRDDDDDDDDDDDDR DDDRDDDD...
result:
ok ok (50 test cases)
Test #16:
score: 0
Accepted
time: 2ms
memory: 4024kb
input:
10 2 23 BBWWBBWWWBWBWBBWBBBWWBW BWWBBWWWBWBWBBWBBBWWBWB 87 44 BBWBWBWBWWWWWWBWWBBBWBBBBWWWWBBBBBBWBWWWWBWW BBWBBBWBWBWBBWWBBBWWBWWWWBWBBBBWWWWBBBBBWBWW WBWBBWBWBBBWBWWWBBBBWWBWBWWBWBWWWWWBBBWWBBWB WBWWWWWWBWWWBBBBBWBBBWBBWWWBBBBBBBWWWWWWWWWB BWBWWBBWBBBBBBBBWBBBWBBWWBBBBBWBWBWBBWWBWBWW BBBWBBBBBBWWB...
output:
YES 24 RRRRRRRRRRRRRRRRRRRRRRD RRRRRRRRRRRRRRRRRRRRRDR RRRRRRRRRRRRRRRRRRRRDRR DRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRRRRRRRRRDRRRR DRRRRRRRRRRRRRRRRRRRRRR DRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRRRRRRDRRRRRRR RRRRRRRRRRRRRRDRRRRRRRR DRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRRRDRRRRRRRRRR RRRRRRRRRRRDRRRRRRRRRRR RRRRR...
result:
ok ok (10 test cases)
Extra Test:
score: 0
Extra Test Passed