#4662
Profesorul de informatică trebuie să corecteze tezele a m
elevi. Elevii au avut de rezolvat n
probleme în teză, numerotate de la 1 la n
. Fiecare elev a rezolvat toate problemele, deci profesorul are de corectat în total m x n
probleme. La începerea corectării fiecărei teze, trebuie identificat numele elevului, proces care durează exact p
secunde de fiecare dată, chiar dacă se revine la aceeași teză de mai multe ori.
După începerea corectării unei teze, căutarea fiecărei probleme durează k
secunde. Corectarea primei probleme din submulțimea aleasă durează t[1]
secunde, corectarea celei de-a doua probleme durează t[2]
secunde ș.a.m.d. Se garantează că t[1] < t[2] < ... < t[n]
. De fiecare dată când se revine la o anumită teză și se reîncepe corectarea ei cu o altă submulțime de probleme, corectarea primei probleme din submulțime va dura din nou t[1]
secunde.
Să se determine timpul minim în care pot fi corectate cele m
lucrări.
Problema | teze | Operații I/O |
![]() teze.in /teze.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #56052167 | Utilizator | |
Fișier | teze.cpp | Dimensiune | 5.43 KB |
Data încărcării | 04 Februarie 2025, 11:40 | Scor / rezultat | Eroare de compilare |
teze.cpp:5:9: error: expected unqualified-id before '__int128' typedef __int128 int128; ^ teze.cpp:10:26: error: 'int128' was not declared in this scope unsigned long long modOf(int128 x) { ^ teze.cpp:10:36: error: expected ',' or ';' before '{' token unsigned long long modOf(int128 x) { ^ teze.cpp:19:8: error: 'int128' was not declared in this scope vector<int128> pref; // pref[0] = 0, pref[i] = C[0]+...+C[i-1], i=0,...,q ^ teze.cpp:19:14: error: template argument 1 is invalid vector<int128> pref; // pref[0] = 0, pref[i] = C[0]+...+C[i-1], i=0,...,q ^ teze.cpp:19:14: error: template argument 2 is invalid teze.cpp:19:20: error: invalid type in declaration before ';' token vector<int128> pref; // pref[0] = 0, pref[i] = C[0]+...+C[i-1], i=0,...,q ^ teze.cpp:20:8: error: 'int128' was not declared in this scope vector<int128> prefW; // prefW[0]=0, prefW[i] = sum_{j=0}^{i-1} (j+1)*C[j] ^ teze.cpp:20:14: error: template argument 1 is invalid vector<int128> prefW; // prefW[0]=0, prefW[i] = sum_{j=0}^{i-1} (j+1)*C[j] ^ teze.cpp:20:14: error: template argument 2 is invalid teze.cpp:20:21: error: invalid type in declaration before ';' token vector<int128> prefW; // prefW[0]=0, prefW[i] = sum_{j=0}^{i-1} (j+1)*C[j] ^ teze.cpp:21:8: error: 'int128' was not declared in this scope vector<int128> Rsum; // Rsum[r] = sum_{j=0}^{r-1} (r - j)*C[j], pentru r=0,...,q ^ teze.cpp:21:14: error: template argument 1 is invalid vector<int128> Rsum; // Rsum[r] = sum_{j=0}^{r-1} (r - j)*C[j], pentru r=0,...,q ^ teze.cpp:21:14: error: template argument 2 is invalid teze.cpp:21:20: error: invalid type in declaration before ';' token vector<int128> Rsum; // Rsum[r] = sum_{j=0}^{r-1} (r - j)*C[j], pentru r=0,...,q ^ teze.cpp:25:1: error: 'int128' does not name a type int128 S1_global = 0, S2_global = 0; ^ teze.cpp: In function 'void precomputeCycleSums()': teze.cpp:29:10: error: request for member 'resize' in 'pref', which is of non-class type 'int' pref.resize(q+1, 0); ^ teze.cpp:30:11: error: invalid types 'int[int]' for array subscript pref[0] = 0; ^ teze.cpp:32:17: error: invalid types 'int[int]' for array subscript pref[i+1] = pref[i] + C[i]; ^ teze.cpp:32:27: error: invalid types 'int[int]' for array subscript pref[i+1] = pref[i] + C[i]; ^ teze.cpp:34:11: error: request for member 'resize' in 'prefW', which is of non-class type 'int' prefW.resize(q+1, 0); ^ teze.cpp:35:12: error: invalid types 'int[int]' for array subscript prefW[0] = 0; ^ teze.cpp:37:18: error: invalid types 'int[int]' for array subscript prefW[i+1] = prefW[i] + (int128)(i+1)* C[i]; ^ teze.cpp:37:29: error: invalid types 'int[int]' for array subscript prefW[i+1] = prefW[i] + (int128)(i+1)* C[i]; ^ teze.cpp:37:34: error: 'int128' was not declared in this scope prefW[i+1] = prefW[i] + (int128)(i+1)* C[i]; ^ teze.cpp:39:10: error: request for member 'resize' in 'Rsum', which is of non-class type 'int' Rsum.resize(q+1, 0); ^ teze.cpp:40:11: error: invalid types 'int[int]' for array subscript Rsum[0] = 0; ^ teze.cpp:42:9: error: 'int128' was not declared in this scope int128 sumVal = 0; ^ teze.cpp:42:16: error: expected ';' before 'sumVal' int128 sumVal = 0; ^ teze.cpp:44:13: error: 'sumVal' was not declared in this scope sumVal += (r - j) * C[j]; ^ teze.cpp:46:15: error: invalid types 'int[int]' for array subscript Rsum[r] = sumVal; ^ teze.cpp:46:19: error: 'sumVal' was not declared in this scope Rsum[r] = sumVal; ^ teze.cpp:48:5: error: 'S1_global' was not declared in this scope S1_global = pref[q]; ^ teze.cpp:48:23: error: invalid types 'int[int]' for array subscript S1_global = pref[q]; ^ teze.cpp:49:5: error: 'S2_global' was not declared in this scope S2_global = prefW[q] - pref[q]; // deoarece sum_{j=0}^{q-1} (j+1)*C[j] - sum_{j=0}^{q-1} C[j] = sum_{j=0}^{q-1} j * C[j] ^ teze.cpp:49:24: error: invalid types 'int[int]' for array subscript S2_global = prefW[q] - pref[q]; // deoarece sum_{j=0}^{q-1} (j+1)*C[j] - sum_{j=0}^{q-1} C[j] = sum_{j=0}^{q-1} j * C[j] ^ teze.cpp:49:34: error: invalid types 'int[int]' for array subscript S2_global = prefW[q] - pref[q]; // deoarece sum_{j=0}^{q-1} (j+1)*C[j] - sum_{j=0}^{q-1} C[j] = sum_{j=0}^{q-1} j * C[j] ^ teze.cpp: At global scope: teze.cpp:55:1: error: 'int128' does not name a type int128 compute_S(long long L) { ^ teze.cpp:77:1: error: 'int128' does not name a type int128 segmentCost(long long r) { ^ teze.cpp:86:1: error: 'int128' does not name a type int128 deltaCost(long long r) { ^ teze.cpp: In function 'int main()': teze.cpp:129:5: error: 'int128' was not declared in this scope int128 best = (int128)LLONG_MAX; ^ teze.cpp:129:12: error: expected ';' before 'best' int128 best = (int128)LLONG_MAX; ^ teze.cpp:133:16: error: expected ';' before 'A_r' int128 A_r = segmentCost(r_val); ^ teze.cpp:134:16: error: expected ';' before 'A_r_next' int128 A_r_next = segmentCost(r_val + 1); ^ teze.cpp:135:16: error: expected ';' before 'Delta' int128 Delta = A_r_next - A_r; // Δ = A(r+1)-A(r) ^ teze.cpp:138:16: error: expected ';' before 'coeff' int128 coeff = A_r + p - (int128) r_val * Delta; // coeficientul liniar ^ teze.cpp:143:12: error: 'coeff' was not declared in this scope if(coeff > 0) ^ teze.cpp:150:16: error: expected ';' before 'candidateVal' int128 candidateVal = (int128) n * Delta + candidate_L * coeff; ^ teze.cpp:151:12: error: 'candidateVal' was not declared in this scope if(candidateVal < best) best = candidateVal; ^ teze.cpp:151:27: error: 'best' was not declared in this scope if(candidateVal < best) best = candidateVal; ^ teze.cpp:158:12: error: expected ';' before 'perTeza' int128 perTeza = (int128) k * n + best; ^ teze.cpp:160:12: error: expected ';' before 'totalTime' int128 totalTime = (int128) m * perTeza; ^ teze.cpp:163:36: error: 'totalTime' was not declared in this scope unsigned long long ans = modOf(totalTime); ^ teze.cpp:163:45: error: 'modOf' cannot be used as a function unsigned long long ans = modOf(totalTime); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema teze 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ă.