#153
drept
La ora de geometrie, Aurel a primit de la profesorul X o temă foarte dificilă: fiind date N
segmente orizontale (paralele cu axa Ox
), cu extremităţile de coordonate numere naturale, să se numere câte dreptunghiuri speciale pot fi formate în plan, luând în considerare aceste segmente.
Un dreptunghi este special dacă respectă simultan următoarele trei condiţii:
1. Cele patru vârfuri ale dreptunghiului au coordonate numere naturale
2. Laturile dreptunghiului sunt paralele cu axa Ox
, respectiv Oy
3. Fiecare dintre cele patru vârfuri ale dreptunghiului aparţine cel puţin unui segment
Scrieţi un program care să-l ajute pe Aurel să determine numărul de posibilităţi de a plasa un dreptunghi în plan astfel încât să fie dreptunghi special. Deoarece rezultatul poate fi foarte mare, se va determina numărul modulo 946021
(restul împărţirii numărului calculat la 946021
).
Problema | drept | Operații I/O |
drept.in /drept.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #49572703 | Utilizator | |
Fișier | drept.cpp | Dimensiune | 3.79 KB |
Data încărcării | 07 Martie 2024, 13:54 | Scor / rezultat | Eroare de compilare |
drept.cpp:94:12: warning: missing terminating " character [enabled by default] printf("%d ^ drept.cpp:94:5: error: missing terminating " character printf("%d ^ drept.cpp:95:1: warning: missing terminating " character [enabled by default] ", res); ^ drept.cpp:95:1: error: missing terminating " character drept.cpp:171:12: warning: missing terminating " character [enabled by default] printf("%d ^ drept.cpp:171:5: error: missing terminating " character printf("%d ^ drept.cpp:172:1: warning: missing terminating " character [enabled by default] ", res); ^ drept.cpp:172:1: error: missing terminating " character drept.cpp: In function 'void normalize()': drept.cpp:47:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(j = 0; j < Y[i].size(); j++) ^ drept.cpp:50:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(j+1 < Y[i].size() && Y[i][j+1].first >= Y[i][k].first && Y[i][j+1].first <= Y[i][k].second) ^ drept.cpp: In function 'void solve()': drept.cpp:74:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(indi < Y[i].size() && indj < Y[j].size()) ^ drept.cpp:74:58: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(indi < Y[i].size() && indj < Y[j].size()) ^ drept.cpp:69:15: warning: unused variable 'k' [-Wunused-variable] int i, j, k, indi, indj, r; ^ drept.cpp: In function 'int main()': drept.cpp:96:5: error: expected primary-expression before 'return' return 0; ^ drept.cpp: At global scope: drept.cpp:106:5: error: redefinition of 'int N' int N, res; ^ drept.cpp:29:5: error: 'int N' previously declared here int N, res; ^ drept.cpp:106:8: error: redefinition of 'int res' int N, res; ^ drept.cpp:29:8: error: 'int res' previously declared here int N, res; ^ drept.cpp:107:21: error: redefinition of 'std::vector<std::pair<int, int> > Y [1010]' vector< PI > Y[MAX_Y]; ^ drept.cpp:30:14: error: 'std::vector<std::pair<int, int> > Y [1010]' previously declared here vector< PI > Y[MAX_Y]; ^ drept.cpp: In function 'void read_data()': drept.cpp:109:6: error: redefinition of 'void read_data()' void read_data(void) ^ drept.cpp:32:6: error: 'void read_data()' previously defined here void read_data(void) ^ drept.cpp: In function 'void normalize()': drept.cpp:117:6: error: redefinition of 'void normalize()' void normalize(void) ^ drept.cpp:40:6: error: 'void normalize()' previously defined here void normalize(void) ^ drept.cpp:124:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(j = 0; j < Y[i].size(); j++) ^ drept.cpp:127:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(j+1 < Y[i].size() && Y[i][j+1].first >= Y[i][k].first && Y[i][j+1].first <= Y[i][k].second) ^ drept.cpp: In function 'int intersect(std::pair<int, int>, std::pair<int, int>)': drept.cpp:135:5: error: redefinition of 'int intersect(std::pair<int, int>, std::pair<int, int>)' int intersect(PI a, PI b) ^ drept.cpp:58:5: error: 'int intersect(std::pair<int, int>, std::pair<int, int>)' previously defined here int intersect(PI a, PI b) ^ drept.cpp: In function 'void solve()': drept.cpp:144:6: error: redefinition of 'void solve()' void solve(void) ^ drept.cpp:67:6: error: 'void solve()' previously defined here void solve(void) ^ drept.cpp:151:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(indi < Y[i].size() && indj < Y[j].size()) ^ drept.cpp:151:58: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(indi < Y[i].size() && indj < Y[j].size()) ^ drept.cpp:146:15: warning: unused variable 'k' [-Wunused-variable] int i, j, k, indi, indj, r; ^ drept.cpp: In function 'int main()': drept.cpp:164:5: error: redefinition of 'int main()' int main(void) ^ drept.cpp:87:5: error: 'int main()' previously defined here int main(void) ^ drept.cpp:173:5: error: expected primary-expression before 'return' return 0; ^ drept.cpp: In function 'void read_data()': drept.cpp:35:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ^ drept.cpp:37:70: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d %d", &y, &a, &b), Y[y].push_back(make_pair(a,b)); ^ drept.cpp: In function 'int main()': drept.cpp:89:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("drept.in", "rt", stdin); ^ drept.cpp:90:39: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("drept.out", "wt", stdout); ^ drept.cpp: In function 'void read_data()': drept.cpp:112:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ^ drept.cpp:114:70: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d %d", &y, &a, &b), Y[y].push_back(make_pair(a,b)); ^ drept.cpp: In function 'int main()': drept.cpp:166:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("drept.in", "rt", stdin); ^ drept.cpp:167:39: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("drept.out", "wt", stdout); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema drept 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ă.