Submission #117103

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1171032019-06-14 20:16:36MeloricPaint By Numbers (IOI16_paint)C++14
100 / 100
1046 ms105736 KiB
#include "paint.h"
#include <iostream>
#include <cstdlib>
#define pb push_back
#define pii pair<int, int>
#define X first
#define Y second
using namespace std;
vector<vector<int>> mem;
vector<int> whi;
vector<pii> ans;
int n, k;
int dp(int i, int j, string &s, vector<int>& c){
if(i >= n && j == k)return 1;
if(i >= n)return 0;
if(j==k && s[i] == 'X')return 0;
if(mem[i][j]!=-1)return mem[i][j];
int val = 0;
if(s[i]!='X'){
if(dp(i+1, j, s, c)){
ans[i].X = 1;
val = 1;
//cout << i << ' '<<j <<'i'<<'\n';
}
}
if(j != k && i+c[j] < whi.size() && whi[i+c[j]]-whi[i] == 0){
if(i+c[j] == s.size() || s[i+c[j]] != 'X'){
if(dp(i+c[j]+1, j+1, s, c)){
ans[i+c[j]].X = 1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

paint.cpp: In function 'int dp(int, int, std::__cxx11::string&, std::vector<int>&)':
paint.cpp:27:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(j != k && i+c[j] < whi.size() && whi[i+c[j]]-whi[i] == 0){
                  ~~~~~~~^~~~~~~~~~~~
paint.cpp:28:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(i+c[j] == s.size() || s[i+c[j]] != 'X'){
            ~~~~~~~^~~~~~~~~~~
paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:53:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 1; i < ans.size(); i++){
                    ~~^~~~~~~~~~~~
paint.cpp:57:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < ans.size()-1; 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...