#3860
consecutive1
Se dă un șir (a[1], a[2], ..., a[n])
de numere naturale cuprinse între 1
și n
. Se dau de asemenea Q
interogări, fiecare prin două numere x
, y
: dacă s-ar ordona a[x], a[x+1], ..., a[y]
, se obține sau nu o secvență de numere consecutive? (De exemplu, 5,3,6,4
dacă e ordonată se obține 3,4,5,6
, care este o secvență de numere consecutive). Dându-se Q
întrebări, să se răspundă la acestea. La fiecare interogare, dacă prin sortare se obține o secvență de numere consecutive veți afișa valoarea 1
, iar în caz contrar veți afișa valoarea 0
.
EJOI 2021, sesiunea de antrenament
Problema | consecutive1 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 256 MB
/
Stivă 8 MB
|
Id soluție | #53188932 | Utilizator | |
Fișier | consecutive1.cpp | Dimensiune | 1.69 KB |
Data încărcării | 20 Octombrie 2024, 19:37 | Scor / rezultat | Eroare de compilare |
consecutive1.cpp:2:14: error: expected unqualified-id before numeric constant #define nmax 100001 ^ consecutive1.cpp:5:11: note: in expansion of macro 'nmax' const int nmax = 100001 ^ consecutive1.cpp: In function 'void read()': consecutive1.cpp:12:12: error: 'n' was not declared in this scope cin >> n; ^ consecutive1.cpp:14:16: error: 'a' was not declared in this scope cin >> a[i]; ^ consecutive1.cpp: In function 'void ConstructieP()': consecutive1.cpp:21:22: error: 'n' was not declared in this scope for (i = 1; i <= n; i++) ^ consecutive1.cpp:23:13: error: 'a' was not declared in this scope x = a[i]; ^ consecutive1.cpp: In function 'void RMQ()': consecutive1.cpp:38:22: error: 'n' was not declared in this scope for (i = 2; i <= n; i++) ^ consecutive1.cpp:41:22: error: 'n' was not declared in this scope for (i = 1; i <= n; i++) ^ consecutive1.cpp:42:9: error: 'rmin' was not declared in this scope rmin[0][i] = a[i]; ^ consecutive1.cpp:42:22: error: 'a' was not declared in this scope rmin[0][i] = a[i]; ^ consecutive1.cpp:44:29: error: 'n' was not declared in this scope for (i = 1; (1 << i) <= n; i++) ^ consecutive1.cpp:48:13: error: 'rmin' was not declared in this scope rmin[i][j] = min(rmin[i - 1][j], rmin[i - 1][j - k]); ^ consecutive1.cpp:51:22: error: 'n' was not declared in this scope for (i = 1; i <= n; i++) ^ consecutive1.cpp:52:9: error: 'rmax' was not declared in this scope rmax[0][i] = a[i]; ^ consecutive1.cpp:52:22: error: 'a' was not declared in this scope rmax[0][i] = a[i]; ^ consecutive1.cpp:54:29: error: 'n' was not declared in this scope for (i = 1; (1 << i) <= n; i++) ^ consecutive1.cpp:58:13: error: 'rmax' was not declared in this scope rmax[i][j] = max(rmax[i - 1][j], rmax[i - 1][j - k]); ^ consecutive1.cpp: In function 'void query()': consecutive1.cpp:72:21: error: 'rmin' was not declared in this scope m = min(rmin[k][x + (1<<k) - 1], rmin[k][y]); ^ consecutive1.cpp:73:21: error: 'rmax' was not declared in this scope M = max(rmax[k][x + (1<<k) - 1], rmax[k][y]); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema consecutive1 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ă.