Submission #195621

#TimeUsernameProblemLanguageResultExecution timeMemory
195621juanmartinez111Paint By Numbers (IOI16_paint)C++14
7 / 100
2 ms380 KiB
#include "paint.h" #include <cstdlib> using namespace std; int visi[104]; int minimo=0; long long cx=0,n; vector<int>paredes,posible; string nw=""; std::string solve_puzzle(std::string s, std::vector<int> c) { string a="",hay="",nw="",b=""; for(int i=0;i<s.size();i++)visi[i]=-1; for(int i=0;i<c.size();i++){ for(int j=0;j<c[i];j++)hay+='X'; if(i+1<c.size())hay+='_'; } for(int i=0;i<s.size();i++){ if(b.size()+hay.size()>s.size())break; nw=""; nw+=b; nw+=hay; while(nw.size()<s.size())nw+='.'; for(int j=0;j<nw.size();j++){ if(visi[j]==-1){ if(nw[j]=='_')visi[j]=1; else if(nw[j]=='X')visi[j]=2; else visi[j]=0; } else if(nw[j]=='.' and visi[j]!=0)visi[j]=3; else if(nw[j]=='_' and visi[j]!=1)visi[j]=3; else if(nw[j]=='X' and visi[j]!=2)visi[j]=3; } b+='.'; } for(int i=0;i<s.size();i++){ if(visi[i]==3)a+='?'; else if(visi[i]==1)a+='.'; else a+='X'; } return a; }

Compilation message (stderr)

paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:13:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++)visi[i]=-1;
                 ~^~~~~~~~~
paint.cpp:14:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<c.size();i++){
                 ~^~~~~~~~~
paint.cpp:16:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(i+1<c.size())hay+='_';
            ~~~^~~~~~~~~
paint.cpp:18:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++){
                 ~^~~~~~~~~
paint.cpp:24:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<nw.size();j++){
                     ~^~~~~~~~~~
paint.cpp:36:18: 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...