Submission #1039998

#TimeUsernameProblemLanguageResultExecution timeMemory
1039998enderPaint By Numbers (IOI16_paint)C++17
7 / 100
1 ms348 KiB
#include "paint.h" #include <bits/stdc++.h> #include <cstdlib> using namespace std; std::string solve_puzzle(std::string s, std::vector<int> c) { vector<string> solutions; int k = c[0]; string ans = ""; for(int i = 0; i < s.size(); ++i){ string temp = s; if(i+k > s.size()) break; for(int j = i; j < i+k; ++j){ temp[j] = 'X'; } for(auto &y : temp){ if(y == '.') y = '_'; } solutions.push_back(temp); } for(int i = 0; i < s.size(); ++i){ bool check = false; for(int j = 1; j < solutions.size(); ++j){ if(solutions[j-1][i] != solutions[j][i]){ ans += '?'; check = true; break; } } if(check) continue; ans += solutions[0][i]; } return ans; }

Compilation message (stderr)

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i = 0; i < s.size(); ++i){
      |                    ~~^~~~~~~~~~
paint.cpp:17:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         if(i+k > s.size()) break;
      |            ~~~~^~~~~~~~~~
paint.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int i = 0; i < s.size(); ++i){
      |                    ~~^~~~~~~~~~
paint.cpp:41:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(int j = 1; j < solutions.size(); ++j){
      |                        ~~^~~~~~~~~~~~~~~~~~
#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...