제출 #119964

#제출 시각아이디문제언어결과실행 시간메모리
119964LawlietPaint By Numbers (IOI16_paint)C++14
0 / 100
2 ms256 KiB
#include <bits/stdc++.h>
#include "paint.h"


#define MAX 110

using namespace std;

int N, K;

string ans;

vector<int> blocks;

std::string solve_puzzle(string s, std::vector<int> c)
{
	N = s.size();
	K = c.size();

	for(int g = 0 ; g < N ; g++)
		ans[g] = 'p';

	for(int g = 0 ; g < N ; g++)
		if(s[g] == '_')
			blocks.push_back(g);

	int l = 0;
	int indClue = 0;
	int indBlocked = 0;

	while(l < N && s[l] == '_')
		l++, indBlocked++;//primeiro que posso colocar

	//printf("l = %d     indBlocked = %d  %d\n",l,indBlocked,blocks.front());

	while(indClue < K)
	{
		//printf("oiii\n");
		while(indBlocked < blocks.size() && (-(l - blocks[indBlocked]) < c[indClue]))
		{
			//printf("tra     %d %d   %d\n",l,blocks[indBlocked],c[indClue]);
			l = blocks[indBlocked] + 1;
			indBlocked++;
		}

		for(int g = l ; g < l + c[indClue] ; g++)
			ans[g] = 'X';

		l += c[indClue] + 1;
		indClue++;

		//printf("l = %d   indb = %d   indc = %d\n",l,indBlocked,indClue);
	}

	for(int g = 0 ; g < N ; g++)
		if(ans[g] == 'p')
			ans[g] = '_';

	printf("%s\n",ans.c_str());

	return ans;
}

/*int main()
{
	string l;
	int cc;
	int n1;
	vector<int> ll;
	cin >> l;
	cin >> cc;

	for(int g = 0 ; g < cc ; g++)
	{
		scanf("%d",&n1);

		ll.push_back(n1);
	}

	printf("%s\n",solve_puzzle(l , ll).c_str());
}*/

컴파일 시 표준 에러 (stderr) 메시지

paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:39:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(indBlocked < blocks.size() && (-(l - blocks[indBlocked]) < c[indClue]))
         ~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...