Submission #68931

#TimeUsernameProblemLanguageResultExecution timeMemory
68931nvmdavaPaint By Numbers (IOI16_paint)C++17
Compilation error
0 ms0 KiB
//#include "paint.h" #include <bits/stdc++.h> using namespace std; bool pos[200001][101]; string ans, s; int c[200001]; vector<int> v; bool swapx(int i, int j){ int l; if(i >= v[j]){ if(s[i - v[j]] == 'X'){ return 0; } } for(l = 1; l < v[j]; l++){ if(s[i - l] == '_'){ break; } } if(l == v[j]){ if(i >= v[j]) return pos[i - v[j]][j]; return pos[i - v[j] + 1][j]; } } string solve_puzzle(string s, vector<int> v) { ::v = v; ::s = s; int n = v.size(), sz = s.size(), i, j; ans = s; pos[0][0] = 1; for(i = 1; i <= sz; i++){ if(s[i - 1] == 'X'){ break; } pos[i][0] = 1; } for(i = 1; i <= sz; i++){ for(j = 1; j <= n; j++){ if(i < v[j - 1]){ continue; } if(s[i - 1] == 'X'){ pos[i][j] = swapx(i - 1, j - 1); } else if(s[i - 1] =='_'){ pos[i][j] = pos[i - 1][j]; } else { pos[i][j] = (pos[i - 1][j] == 0 ? swapx(i - 1, j - 1) : 1); } } } check(sz, n); return ans; } int main(){ string s; cin>>s; int k; cin>>k; vector<int> a; while(k--){ int d; cin>>d; a.push_back(d); } solve_puzzle(s, a); }

Compilation message (stderr)

paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:55:2: error: 'check' was not declared in this scope
  check(sz, n);
  ^~~~~
paint.cpp:55:2: note: suggested alternative: 'clock'
  check(sz, n);
  ^~~~~
  clock
paint.cpp: In function 'bool swapx(int, int)':
paint.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^