제출 #465773

#제출 시각아이디문제언어결과실행 시간메모리
465773MohamedFaresNebiliHandcrafted Gift (IOI20_gift)C++14
20 / 100
1590 ms2097156 KiB
#include "gift.h" #include <bits/stdc++.h> using namespace std; bool used=false; void solve(int i, string s, int n, int r, vector<int> a, vector<int> b, vector<int> x) { if(used) return; if(i==n) { bool found=true; for(int l=0;l<r&&found;l++) { int lo=a[l], hi=b[l], v=x[l]; if(v==1) { int r=0, bl=0; for(int i=lo;i<=hi;i++) { if(s[i]=='R') r++; if(s[i]=='B') bl++; } if(r!=0&&bl!=0) found=false; } else if(v==2) { int r=0, bl=0; for(int i=lo;i<=hi;i++) { if(s[i]=='R') r++; if(s[i]=='B') bl++; } if(r==0||bl==0) found=false; } } if(found) { used=true; craft(s); } return; } solve(i+1, s+"R", n, r, a, b, x); solve(i+1, s+"B", n, r, a, b, x); } int construct(int n, int r, std::vector<int> a, std::vector<int> b, std::vector<int> x) { solve(0, "", n, r, a, b, x); 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...