Submission #30497

# Submission time Handle Problem Language Result Execution time Memory
30497 2017-07-24T07:22:18 Z abbomar Paint By Numbers (IOI16_paint) C++14
Compilation error
0 ms 0 KB
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;

string solve_puzzle(string s, int k, int c[])
{
    string res = s;
    int index = 0;
    for ( int j = 0 ; j < sizeof(c)/sizeof(c[0]) ; j ++ )
    {
        int b = c[j];
        for (int i = 0 ; i < b ; i ++ )
        {
            res[index++] = 'X';
        }
        res[index++] = '_';
    }
    for (int i = index ; i < res.size() ; i ++ )
        res[i] = '_';
    
    return res;
}

Compilation message

paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, int, int*)':
paint.cpp:9:35: warning: 'sizeof' on array function parameter 'c' will return size of 'int*' [-Wsizeof-array-argument]
     for ( int j = 0 ; j < sizeof(c)/sizeof(c[0]) ; j ++ )
                                   ^
paint.cpp:5:44: note: declared here
 string solve_puzzle(string s, int k, int c[])
                                            ^
paint.cpp:9:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for ( int j = 0 ; j < sizeof(c)/sizeof(c[0]) ; j ++ )
                         ^
paint.cpp:18:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = index ; i < res.size() ; i ++ )
                            ^
/tmp/ccxxLgu2.o: In function `main':
grader.cpp:(.text.startup+0x1e3): undefined reference to `solve_puzzle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status