Submission #194158

#TimeUsernameProblemLanguageResultExecution timeMemory
194158s_avila_gPaint By Numbers (IOI16_paint)C++14
0 / 100
5 ms632 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; string a[posi]; for(int i = 0 ; i < posi; i++){ for(int j = 0 ; j < s.size(); j++){ a[i][j] = '.'; } } 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 < s.size(); j++){ a[i][j] = '_'; pos++; } } int cont; string ans; for(int i = 0 ; i < s.size(); 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; }

Compilation message (stderr)

paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:9:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0 ; j < s.size(); j++){
                         ~~^~~~~~~~~~
paint.cpp:29:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = pos; j < s.size(); j++){
                          ~~^~~~~~~~~~
paint.cpp:36:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0 ; i < s.size(); i++){
                     ~~^~~~~~~~~~
#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...