Submission #194160

#TimeUsernameProblemLanguageResultExecution timeMemory
194160s_avila_gPaint By Numbers (IOI16_paint)C++14
7 / 100
7 ms376 KiB
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;

std::string solve_puzzle(std::string s, std::vector<int> c) {
    int posi = s.size() - c[0] + 1;
    int tam = s.size();
    string a[posi];
    for(int i = 0 ; i < posi; i++){
        for(int j = 0 ; j < tam; j++){
            a[i] += '.';
        }
    }
    int it = 0;
    int pos;
    for(int i = 0 ; i < posi; i++){
        pos = 0;
        int from = pos, to = it;
        for(int j = from; j < to; j++){
            a[i][j] = '_';
            pos++;
        }
        it++;
        from = pos; to = pos+c[0] - 1;
        for(int j = from; j < to + 1; j++){
            a[i][j] = 'X';
            pos++;
        }
        from = pos; to = s.size();
        for(int j = pos; j < to; j++){
            a[i][j] = '_';
            pos++;
        }
    }
    int cont;
    string ans;
    for(int i = 0 ; i < tam; i++){
        cont = 0;
        for(int j = 0 ; j < posi; j++){
            if(a[j][i] == 'X'){
                cont++;
            }
        }
        if(cont == posi){
            ans += 'X';
        }else{
            ans += '?';
        }
    }
    return ans;
}
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...