Submission #30495

#TimeUsernameProblemLanguageResultExecution timeMemory
30495abbomarPaint By Numbers (IOI16_paint)C++14
Compilation error
0 ms0 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; string solve_puzzle(string s, int c[]) { string res = s; int index = 0; for ( int b : c ) { 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 (stderr)

paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, int*)':
paint.cpp:9:19: error: 'begin' was not declared in this scope
     for ( int b : c )
                   ^
paint.cpp:9:19: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94:0,
                 from paint.cpp:2:
/usr/include/c++/5/valarray:1206:5: note:   'std::begin'
     begin(const valarray<_Tp>& __va)
     ^
/usr/include/c++/5/valarray:1206:5: note:   'std::begin'
paint.cpp:9:19: error: 'end' was not declared in this scope
     for ( int b : c )
                   ^
paint.cpp:9:19: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94:0,
                 from paint.cpp:2:
/usr/include/c++/5/valarray:1226:5: note:   'std::end'
     end(const valarray<_Tp>& __va)
     ^
/usr/include/c++/5/valarray:1226:5: note:   'std::end'
paint.cpp:17:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = index ; i < res.size() ; i ++ )
                            ^