Submission #1169242

#TimeUsernameProblemLanguageResultExecution timeMemory
1169242userro1234324Painting Squares (IOI20_squares)C++20
Compilation error
0 ms0 KiB
#include "squares.h" #include <bits/stdc++.h> int N: vector <int> odp; vector <int> pusty; void dodaj_do_odpowiedzi(int ile, int co) { while (ile-- && odp.size() < N) odp.push_back(co); } std::vector<int> paint(int n) { odp p = pusty; for (int i = 1; i <= 29; i++) { dodaj_do_odpowiedzi(i, 1); dodaj_do_odpowiedzi(35 - i, 0); } odp.push_back(70); return odp; } int lokalizacja; void jest_pod_koniec() { int ostatni = odp.size() - 1; while (odp[ostatni] == -1) ostatni--; lokalizacja = n - ostatni - 1; } int pierwsza_jedynka() { int wsk = 0; while (odp[wsk] == 1) wsk++; while (odp[wsk] == 0) wsk++; return wsk; } int ile_jedynek(int indeks) { int zlicz = 0; while (odp[indeks] == 1) { indeks++; zlicz++; } return zlicz; } int ktory_indeks_w_prawdziwym(int ile) { return (ile - 1) * 35; } int find_location(int n, std::vector<int> c) { N = n; odp = c; if (odp.back() == -1) { jest_pod_koniec(); return lokalizacja; } int indeks = pierwsza_jedynka(); int ile = ile_jedynek(indeks); int ktory = ktory_indeks_w_prawdziwym(ile); return ktory - indeks; }

Compilation message (stderr)

squares.cpp:3:6: error: found ':' in nested-name-specifier, expected '::'
    3 | int N:
      |      ^
      |      ::
squares.cpp:3:5: error: 'N' has not been declared
    3 | int N:
      |     ^
squares.cpp:4:8: error: expected initializer before '<' token
    4 | vector <int> odp;
      |        ^
squares.cpp:5:1: error: 'vector' does not name a type
    5 | vector <int> pusty;
      | ^~~~~~
squares.cpp: In function 'void dodaj_do_odpowiedzi(int, int)':
squares.cpp:7:21: error: 'odp' was not declared in this scope
    7 |     while (ile-- && odp.size() < N) odp.push_back(co);
      |                     ^~~
squares.cpp:7:34: error: 'N' was not declared in this scope
    7 |     while (ile-- && odp.size() < N) odp.push_back(co);
      |                                  ^
squares.cpp: In function 'std::vector<int> paint(int)':
squares.cpp:10:9: error: 'odp' was not declared in this scope
   10 |         odp p = pusty;
      |         ^~~
squares.cpp: In function 'void jest_pod_koniec()':
squares.cpp:20:19: error: 'odp' was not declared in this scope
   20 |     int ostatni = odp.size() - 1;
      |                   ^~~
squares.cpp:22:19: error: 'n' was not declared in this scope; did you mean 'yn'?
   22 |     lokalizacja = n - ostatni - 1;
      |                   ^
      |                   yn
squares.cpp: In function 'int pierwsza_jedynka()':
squares.cpp:26:12: error: 'odp' was not declared in this scope
   26 |     while (odp[wsk] == 1) wsk++;
      |            ^~~
squares.cpp:27:12: error: 'odp' was not declared in this scope
   27 |     while (odp[wsk] == 0) wsk++;
      |            ^~~
squares.cpp: In function 'int ile_jedynek(int)':
squares.cpp:32:12: error: 'odp' was not declared in this scope
   32 |     while (odp[indeks] == 1) {
      |            ^~~
squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:41:5: error: 'N' was not declared in this scope
   41 |     N = n;
      |     ^
squares.cpp:42:5: error: 'odp' was not declared in this scope
   42 |     odp = c;
      |     ^~~