Submission #1169092

#TimeUsernameProblemLanguageResultExecution timeMemory
1169092miniobPainting Squares (IOI20_squares)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

string s = "0000000000100000000110000000101000000011100000010010000001011000000110100000011110000010001000001001100000101010000010111000001100100000110110000011101000001111100001000010001100001001010000100111000010100100001010110000101101000010111100001100010000110011000011010100001101110000111001000011101100001111010000111111000100010100010001110001001001000100101100010011010001001111000101001100010101010001010111000101100100010110110001011101000101111100011000110010100011001110001101001000110101100011011010001101111000111001100011101010001110111000111100100011110110001111101000111111100100100110010010101001001011100100110110010011101001001111100101001010011100101010110010101101001010111100101100110010110101001011011100101110110010111101001011111100110011010011001111001101010100110101110011011011001101110100110111110011100111010110011101101001110111100111101010011110111001111101100111111010011111111010101010111010101101101010111110101101011011110101110111010111101101011111110110110111011011111101";

int[] paint(int n)
{
	int odp[n + 1];
	for(int i = 0; i < n; i++)
	{
		if(s[i] == '0')
		{
			odp[i] = 0;
		}
		else
		{
			odp[i] = 1;
		}
	}
	odp[n] = 10;
}

int find_location(int n, int c[])
{
	int ile1 = 0;
	for(int i = 0; i < n; i++)
	{
		if(c[i] == -1)
		{
			ile1++;
		}
	}
	if(ile-1 == 0)
	{
		map<string, int> mapa;
		for(int i = 0; i < 990; i++)
		{
			string cur = "";
			for(int j = i; j < i + 10; j++)
			{
				if(s[j] == 0)
				{
					cur += '0';
				}
				else
				{
					cur += '1';
				}
			}
			mapa[cur] = i;
		}
		string cur = "";
		for(int i = 0; i < 10; i++)
		{
			if(c[i] == 0)	
			{
				cur += '0';
			}
			else
			{
				cur += '1';
			}
		}
		return mapa[cur];
	}
	else
	{
		return n + ile1 - 10;
	}
}

Compilation message (stderr)

squares.cpp:6:4: error: structured binding declaration cannot have type 'int'
    6 | int[] paint(int n)
      |    ^~
squares.cpp:6:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
squares.cpp:6:4: error: empty structured binding declaration
squares.cpp:6:7: error: expected initializer before 'paint'
    6 | int[] paint(int n)
      |       ^~~~~
squares.cpp: In function 'int find_location(int, int*)':
squares.cpp:33:12: error: 'ile' was not declared in this scope; did you mean 'ile1'?
   33 |         if(ile-1 == 0)
      |            ^~~
      |            ile1
squares.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
   70 | }
      | ^