제출 #414897

#제출 시각아이디문제언어결과실행 시간메모리
414897Ahmadsm2005Paint By Numbers (IOI16_paint)C++14
90 / 100
2039 ms28716 KiB
#include "paint.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; bool CAN[200003],CAN2[200003]; int8_t DP[200001][101]; vector<int>F; string t; bool REC(int idx,int CUR){ if(idx>=t.size()&&CUR+1==F.size()) return 1; else if(idx>=t.size()) return 0; if(DP[idx][CUR]+1) return DP[idx][CUR]; DP[idx][CUR]=0; if((F[CUR]+idx)<=t.size()){ for(int i=idx;i<idx+F[CUR];i++){ if(t[i]=='_') goto a; } if((idx+F[CUR]>=t.size())||(t[idx+F[CUR]]!='X')) if(REC(idx+F[CUR]+1,CUR+1)){ for(int i=idx;i<idx+F[CUR];i++) CAN[i]=1; CAN2[idx+F[CUR]]=1; DP[idx][CUR]=1; } } a:; if(t[idx]!='X'){ if(REC(idx+1,CUR)){ CAN2[idx]=1; DP[idx][CUR]=1; } } return DP[idx][CUR]; } string solve_puzzle(string s,vector<int>c){ F=c; F.push_back(INT_MAX); t=s; string ANS; for(int i=0;i<=200000;i++) for(int l=0;l<=100;l++) DP[i][l]=-1; REC(0,0); for(int i=0;i<s.size();i++){ if(s[i]=='.'){ if(CAN[i]&&CAN2[i]) ANS+='?'; else if(CAN[i]) ANS+='X'; else ANS+='_'; } else ANS+=s[i]; } return ANS; }

컴파일 시 표준 에러 (stderr) 메시지

paint.cpp: In function 'bool REC(int, int)':
paint.cpp:10:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | if(idx>=t.size()&&CUR+1==F.size())
      |    ~~~^~~~~~~~~~
paint.cpp:10:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | if(idx>=t.size()&&CUR+1==F.size())
      |                   ~~~~~^~~~~~~~~~
paint.cpp:12:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | else if(idx>=t.size())
      |         ~~~^~~~~~~~~~
paint.cpp:17:16: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 | if((F[CUR]+idx)<=t.size()){
      |    ~~~~~~~~~~~~^~~~~~~~~~
paint.cpp:22:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 | if((idx+F[CUR]>=t.size())||(t[idx+F[CUR]]!='X'))
      |     ~~~~~~~~~~^~~~~~~~~~
paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:48:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 | 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...