Submission #92611

#TimeUsernameProblemLanguageResultExecution timeMemory
92611turbatPaint By Numbers (IOI16_paint)C++14
Compilation error
0 ms0 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; #define N 200005 int n, t, ok, now, cnt[N], l[105], r[105], dp[N][105][2]; string ans, st; vecter <int> ve; void rec(int x, int idx){ if (dp[x][idx] != -1) return; if (!idx){ if (x + 1 >= ve[0] && !cnt[x - ve[0]] && (idx != t - 1 || !(cnt[n - 1] - cnt[x])) ) { dp[x][idx] = 1; r[idx] = max(r[idx], x); l[idx] = min(l[idx], x); } else dp[x][idx] = 0; return; } if (st[x - ve[idx]] != 'X') rec(x - ve[idx] - 1, idx - 1); else dp[x - ve[idx]][idx] = 0; if (x + 1 >= ve[idx] && dp[x - ve[idx]][idx - 1]&& !(cnt[x] - cnt[x - ve[idx]]) && (idx != t - 1 || !(cnt[n - 1] - cnt[x])) ){ if (st[x + 1] != 'X') dp[x + 1][idx] = 1; r[idx] = max(r[idx], x); l[idx] = min(l[idx], x); rec(x - 1, idx); } else dp[x][idx] = 0; } string solve_puzzle(string s, vector<int> c) { st = s; ve = c; n = s.size(); t = c.size(); for (int i = 0;i < t;i++) l[i] = n; now = 0; memset(dp, -1, sizeof dp); for (int i = 0;i < n;i++){ cnt[i] = cnt[i - 1] + s[i - 1] == '_'; ans += '?'; } rec(n - 1, t - 1); for (int i = 0;i <= l[0] - ve[0];i++) ans[i] = '_'; for (int i = r[t - 1] + 1; i < n;i++) ans[i] = '_'; for (int i = 0;i < t;i++){ if (i) for (int j = r[i - 1] + 1;j <= l[i] - ve[i];j++) ans[j] = '_'; for (int j = r[i] - ve[i];j < l[i];j++) ans[j] = 'X'; } return ans; }

Compilation message (stderr)

paint.cpp:8:1: error: 'vecter' does not name a type; did you mean 'qecvt_r'?
 vecter <int> ve;
 ^~~~~~
 qecvt_r
paint.cpp: In function 'void rec(int, int)':
paint.cpp:11:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (dp[x][idx] != -1) return;
                     ^
paint.cpp:13:16: error: 've' was not declared in this scope
   if (x + 1 >= ve[0] && !cnt[x - ve[0]] && (idx != t - 1 || !(cnt[n - 1] - cnt[x])) ) {
                ^~
paint.cpp:14:17: error: incompatible types in assignment of 'int' to 'int [2]'
    dp[x][idx] = 1;
                 ^
paint.cpp:18:21: error: incompatible types in assignment of 'int' to 'int [2]'
   else dp[x][idx] = 0;
                     ^
paint.cpp:21:13: error: 've' was not declared in this scope
  if (st[x - ve[idx]] != 'X')
             ^~
paint.cpp:24:15: error: 've' was not declared in this scope
  if (x + 1 >= ve[idx] && dp[x - ve[idx]][idx - 1]&& !(cnt[x] - cnt[x - ve[idx]]) && (idx != t - 1 || !(cnt[n - 1] - cnt[x])) ){
               ^~
paint.cpp:25:42: error: incompatible types in assignment of 'int' to 'int [2]'
   if (st[x + 1] != 'X') dp[x + 1][idx] = 1;
                                          ^
paint.cpp:30:20: error: incompatible types in assignment of 'int' to 'int [2]'
  else dp[x][idx] = 0;
                    ^
paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:35:2: error: 've' was not declared in this scope
  ve = c;
  ^~