제출 #465741

#제출 시각아이디문제언어결과실행 시간메모리
465741MohamedFaresNebiliHandcrafted Gift (IOI20_gift)C++14
0 / 100
1581 ms288 KiB
#include "gift.h" #include <bits/stdc++.h> using namespace std; int N, R; vector<int>aa, bb, xx; bool used=false; void solve(int i, string s) { if(used) return; if(i==N) { bool found=true; for(int l=0;l<R&&found;l++) { int lo=aa[l], hi=bb[l], v=xx[l]; if(v==1) { int r=0, b=0; for(int i=lo;i<=hi;i++) { if(s[i]=='R') r++; if(s[i]=='B') b++; } if(r!=0&&b!=0) found=false; } else if(v==2) { int r=0, b=0; for(int i=lo;i<=hi;i++) { if(s[i]=='R') r++; if(s[i]=='B') b++; } if(r==0||b==0) found=false; } } if(found) { used=true; craft(s); } return; } solve(i+1, s+"R"); solve(i+1, s+"B"); } int construct(int n, int r, std::vector<int> a, std::vector<int> b, std::vector<int> x) { N=n; R=r; aa=a; bb=b; xx=x; solve(0, ""); bool f=true; for(int l=0;l<r&&f;l++) { if(x[l]==2) f=false; } if(f) { for(int l=0;l<n;l++) cout<<"R"; return 1; } if(used) return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...