Submission #1314958

#TimeUsernameProblemLanguageResultExecution timeMemory
1314958Zone_zoneeHandcrafted Gift (IOI20_gift)C++20
0 / 100
1596 ms12904 KiB
#include "gift.h"
#include <bits/stdc++.h>

int construct(int n, int r, std::vector<int> a, std::vector<int> b, std::vector<int> x) {
    using namespace std;
    string s(n, '.');
    for(int i = 0; i < r; ++i){
        if(x[i] == 1) for(int j = a[i]; j <= b[i]; ++j) s[j] = 'R';
    }
    for(int i = 0; i < r; ++i){
        if(x[i] == 2){
            bool ok = 0;
            for(int j = a[i]; j <= b[i]; ++j){
                if(s[j] == '.'){
                    ok = 1;
                    s[j] = 'B';
                }
            }
            if(!ok) return 0;
        }
    }
    for(int i = 0; i < n; ++i){
        if(s[i] == '.') s[i] = 'R';
    }
    craft(s);
    return 1;
}
#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...