Submission #1169063

#TimeUsernameProblemLanguageResultExecution timeMemory
1169063niepamietamhaslaPainting Squares (IOI20_squares)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int* paint(int n){ string skad = "0000000000100001000001000100000010010001001001000000010100100001010001000101000010010100101000001010100100101010001010101010000000011010000001100100000110001000011010100001100001000110100100011001010001100011000001001101000100110010010011000101001101010100110000110011010011001100000010110100001011001000101100010010110101001011001100101100001010110100101011001010101100011010110101100000110110100011011001001101100010110110101011011001101101100000001110100000111001000011101100001110001000111010100011100110001110000100111010010011100101001110110100111000110011101011001110011100000101110100010111001001011101100101110001010111010101011100110101110000110111010011011100101101110110110111000111011101011101110000001111010000111100100011110110001111000100111101010011110011001111011100111100001011110100101111001010111101101011110001101111010110111100111011110111100000111110100011111001001111101100111110001011111010101111100110111110111011111000011111101001111110010111111011011111100011111110101111"; int ans[n+1]; for(int i = 0; i < n; ++i){ ans[i] = (skad[i] == '0' ? 0 : 1); } ans[n] = 10; return ans; } int find_location(int n, int c[]){ string skad = "0000000000100001000001000100000010010001001001000000010100100001010001000101000010010100101000001010100100101010001010101010000000011010000001100100000110001000011010100001100001000110100100011001010001100011000001001101000100110010010011000101001101010100110000110011010011001100000010110100001011001000101100010010110101001011001100101100001010110100101011001010101100011010110101100000110110100011011001001101100010110110101011011001101101100000001110100000111001000011101100001110001000111010100011100110001110000100111010010011100101001110110100111000110011101011001110011100000101110100010111001001011101100101110001010111010101011100110101110000110111010011011100101101110110110111000111011101011101110000001111010000111100100011110110001111000100111101010011110011001111011100111100001011110100101111001010111101101011110001101111010110111100111011110111100000111110100011111001001111101100111110001011111010101111100110111110111011111000011111101001111110010111111011011111100011111110101111"; for(int i = 0; i < 10; ++i){ if(c[i] == -1){ return n - i; } } string W = ""; for(int i = 0; i < 10; ++i){ W += (c[i] == 0 ? '0' : '1'); } for(int i = 0; i < n - 9; ++i){ if(W == skad.substr(i, 10)){ return i; } } return -1; }

Compilation message (stderr)

squares.cpp: In function 'int* paint(int)':
squares.cpp:12:12: warning: address of local variable 'ans' returned [-Wreturn-local-addr]
   12 |     return ans;
      |            ^~~
squares.cpp:7:9: note: declared here
    7 |     int ans[n+1];
      |         ^~~
/usr/bin/ld: /tmp/ccx6GGvL.o: in function `main':
stub.cpp:(.text.startup+0x43d): undefined reference to `find_location(int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status