Submission #92612

#TimeUsernameProblemLanguageResultExecution timeMemory
92612turbatPaint 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];
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: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: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: 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;
  ^~