#4836
Pentru a îmbunătăţi aptitudinile logico-matematice ale elevilor săi, profesorul Vasile a implementat un joc. Pe ecranul principal al jocului se afişează un şir de N scaune, numerotate de la stânga spre dreapta începând cu 1, pe fiecare scaun fiind așezat câte un copil. Fiecare copil poartă un tricou pe care este scris, de asemenea, câte un număr de la 1 la N. Numerele de pe tricouri sunt distincte și sunt scrise pe spate, deci nu sunt vizibile. Scopul jocului este de a descoperi numărul scris pe tricoul fiecărui copil. Pentru aceasta, pe ecran mai este afişat un triunghi de numere T, care ne dă informaţii ajutătoare. Triunghiul arată ca o matrice în care liniile sunt numerotate de sus în jos de la 1 la N, iar coloanele de la stânga la dreapta de la 1 la N. Numărul scris în triunghi pe linia i şi coloana j (1 ≤ i ≤ j ≤ n) reprezintă numărul scaunului pe care stă copilul având cel mai mic număr pe tricou dintre toţi copiii situaţi pe scaune cu numere cuprinse între i şi j (inclusiv i şi j). Observaţi că poziţiile din triunghi de pe linia i şi coloana j cu 1 ≤ j < i ≤ N nu sunt completate. Cunoscând numărul de copii şi triunghiul de numere:
1. determinați o soluţie posibilă; dacă există mai multe soluţii posibile se va afişa cea mai mică din punctul de vedere lexicografic;
2. determinați numărul de soluţii posibile.
ONI 2025, baraj juniori
| Problema | joc16 | Operații I/O |
joc.in/joc.out
|
|---|---|---|---|
| Limita timp | 0.15 secunde | Limita memorie |
Total: 8 MB
/
Stivă 4 MB
|
| Id soluție | #58663294 | Utilizator | |
| Fișier | joc16.cpp | Dimensiune | 4.96 KB |
| Data încărcării | 11 Iulie 2025, 23:50 | Scor/rezultat | Eroare de compilare |
joc16.cpp:6:30: warning: multi-character character constant [-Wmultichar] static const int BASE = 1'000'000'000; // 1e9 ^ joc16.cpp:6:38: warning: missing terminating ' character [enabled by default] static const int BASE = 1'000'000'000; // 1e9 ^ joc16.cpp:6:5: error: missing terminating ' character static const int BASE = 1'000'000'000; // 1e9 ^ joc16.cpp:6:29: error: expected ';' at end of member declaration static const int BASE = 1'000'000'000; // 1e9 ^ joc16.cpp:6:30: error: expected unqualified-id before '\x303030' static const int BASE = 1'000'000'000; // 1e9 ^ joc16.cpp: In member function 'BigInt& BigInt::operator=(long long int)': joc16.cpp:12:9: error: 'd' was not declared in this scope d.clear(); ^ joc16.cpp: In member function 'bool BigInt::isZero() const': joc16.cpp:18:35: error: 'd' was not declared in this scope bool isZero() const { return d.empty(); } ^ joc16.cpp: In member function 'BigInt& BigInt::operator+=(const BigInt&)': joc16.cpp:22:32: error: 'd' was not declared in this scope int carry = 0, n = max(d.size(), other.d.size()); ^ joc16.cpp:22:48: error: 'const struct BigInt' has no member named 'd' int carry = 0, n = max(d.size(), other.d.size()); ^ joc16.cpp:26:58: error: 'const struct BigInt' has no member named 'd' long long sum = 1LL * d[i] + (i < (int)other.d.size() ? other.d[i] : 0) + carry; ^ joc16.cpp:26:75: error: 'const struct BigInt' has no member named 'd' long long sum = 1LL * d[i] + (i < (int)other.d.size() ? other.d[i] : 0) + carry; ^ joc16.cpp: In member function 'BigInt& BigInt::mulInt(int)': joc16.cpp:36:35: error: 'd' was not declared in this scope if (m == 0 || isZero()) { d.clear(); return *this; } ^ joc16.cpp:38:23: error: 'd' was not declared in this scope for (int &x : d) { ^ joc16.cpp:43:20: error: 'd' was not declared in this scope if (carry) d.push_back((int)carry); ^ joc16.cpp: In member function 'int BigInt::divInt(int)': joc16.cpp:50:27: error: 'd' was not declared in this scope for (int i = (int)d.size() - 1; i >= 0; --i) { ^ joc16.cpp:55:17: error: 'd' was not declared in this scope while (!d.empty() && d.back() == 0) d.pop_back(); ^ joc16.cpp: In function 'BigInt operator*(const BigInt&, const BigInt&)': joc16.cpp:63:13: error: 'struct BigInt' has no member named 'd' res.d.assign(a.d.size() + b.d.size(), 0); ^ joc16.cpp:63:24: error: 'const struct BigInt' has no member named 'd' res.d.assign(a.d.size() + b.d.size(), 0); ^ joc16.cpp:63:37: error: 'const struct BigInt' has no member named 'd' res.d.assign(a.d.size() + b.d.size(), 0); ^ joc16.cpp:64:34: error: 'const struct BigInt' has no member named 'd' for (size_t i = 0; i < a.d.size(); ++i) { ^ joc16.cpp:66:38: error: 'const struct BigInt' has no member named 'd' for (size_t j = 0; j < b.d.size() || carry; ++j) { ^ joc16.cpp:67:37: error: 'struct BigInt' has no member named 'd' long long cur = res.d[i + j] + ^ joc16.cpp:68:30: error: 'const struct BigInt' has no member named 'd' 1LL * a.d[i] * (j < b.d.size() ? b.d[j] : 0) + carry; ^ joc16.cpp:68:44: error: 'const struct BigInt' has no member named 'd' 1LL * a.d[i] * (j < b.d.size() ? b.d[j] : 0) + carry; ^ joc16.cpp:68:57: error: 'const struct BigInt' has no member named 'd' 1LL * a.d[i] * (j < b.d.size() ? b.d[j] : 0) + carry; ^ joc16.cpp:69:21: error: 'struct BigInt' has no member named 'd' res.d[i + j] = int(cur % BigInt::BASE); ^ joc16.cpp:73:21: error: 'struct BigInt' has no member named 'd' while (!res.d.empty() && res.d.back() == 0) res.d.pop_back(); ^ joc16.cpp:73:38: error: 'struct BigInt' has no member named 'd' while (!res.d.empty() && res.d.back() == 0) res.d.pop_back(); ^ joc16.cpp:73:57: error: 'struct BigInt' has no member named 'd' while (!res.d.empty() && res.d.back() == 0) res.d.pop_back(); ^ joc16.cpp: In member function 'std::string BigInt::str() const': joc16.cpp:80:30: error: 'd' was not declared in this scope string s = to_string(d.back()); ^ joc16.cpp: In member function 'bool BigInt::isZero() const': joc16.cpp:18:46: warning: control reaches end of non-void function [-Wreturn-type] bool isZero() const { return d.empty(); } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema joc16 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.