#2558
De când a început serviciul militar, Mihai nu și-a găsit vocația și a decis să-și încerce norocul încă o dată, mergând la superiorul său, Căpitanul Dan. De data aceasta, Dan a fost mai amabil, dar i-a cerut lui Mihai să demonstreze talentul său de trăgător.
Vom considera țintele din zona de tragere ca fiind dreptunghiuri în plan. Căpitanul îi indică lui Mihai câteva puncta pe axa OX și direcțiile de tragere. Fiecare tragere este o semidreaptă care poate fi orientată fie diagonal spre stânga la 45o, fie diagonal spre dreapta la 45o, fie pe verticală în sus. Definim costul atingerii unei ținte ca fiind lungimea intersecției semidreptei de tragere cu dreptunghiul care reprezintă ținta. Dacă intersecția este vidă, sau constă dintr-un singur punct, atunci costul este 0. Definim costul unei trageri ca suma costurilor atingerilor tuturor țintelor. Determinați costul fiecărei trageri.
Balcaniada de Informatică 2018, ziua 1
| Problema | shootings | Operații I/O |
shootings.in/shootings.out
|
|---|---|---|---|
| Limita timp | 0.4 secunde | Limita memorie |
Total: 128 MB
/
Stivă 32 MB
|
| Id soluție | #58736680 | Utilizator | |
| Fișier | shootings.cpp | Dimensiune | 5.69 KB |
| Data încărcării | 28 Iulie 2025, 18:45 | Scor/rezultat | Eroare de compilare |
shootings.cpp:8:44: error: '__int128_t' has not been declared std::ostream& operator<<(std::ostream& os, __int128_t val) { ^ shootings.cpp:61:105: error: '__int128_t' was not declared in this scope void solve_vertical(int n, const std::vector<Rect>& rects, const std::vector<Query>& shots, std::vector<__int128_t>& results) { ^ shootings.cpp:61:115: error: template argument 1 is invalid void solve_vertical(int n, const std::vector<Rect>& rects, const std::vector<Query>& shots, std::vector<__int128_t>& results) { ^ shootings.cpp:61:115: error: template argument 2 is invalid shootings.cpp: In function 'void solve_vertical(int, const std::vector<Rect>&, const std::vector<Query>&, int&)': shootings.cpp:82:27: error: invalid types 'int[const long long int]' for array subscript results[ev.val] = (__int128_t)current_height * current_height; ^ shootings.cpp:82:32: error: '__int128_t' was not declared in this scope results[ev.val] = (__int128_t)current_height * current_height; ^ shootings.cpp:82:43: error: expected ';' before 'current_height' results[ev.val] = (__int128_t)current_height * current_height; ^ shootings.cpp: At global scope: shootings.cpp:87:106: error: '__int128_t' was not declared in this scope void solve_diag_left(int n, const std::vector<Rect>& rects, const std::vector<Query>& shots, std::vector<__int128_t>& results) { ^ shootings.cpp:87:116: error: template argument 1 is invalid void solve_diag_left(int n, const std::vector<Rect>& rects, const std::vector<Query>& shots, std::vector<__int128_t>& results) { ^ shootings.cpp:87:116: error: template argument 2 is invalid shootings.cpp: In function 'void solve_diag_left(int, const std::vector<Rect>&, const std::vector<Query>&, int&)': shootings.cpp:107:5: error: '__int128_t' was not declared in this scope __int128_t current_f = 2LL * n * last_p - 2LL * sum_x1_y1; ^ shootings.cpp:107:16: error: expected ';' before 'current_f' __int128_t current_f = 2LL * n * last_p - 2LL * sum_x1_y1; ^ shootings.cpp:112:13: error: 'current_f' was not declared in this scope current_f += (__int128_t)current_slope * (events[event_idx].p - last_p); ^ shootings.cpp:112:38: error: expected ';' before 'current_slope' current_f += (__int128_t)current_slope * (events[event_idx].p - last_p); ^ shootings.cpp:117:20: error: expected ';' before 'f_shot' __int128_t f_shot = current_f + (__int128_t)current_slope * (shot.p - last_p); ^ shootings.cpp:118:24: error: invalid types 'int[const int]' for array subscript results[shot.id] = f_shot * f_shot / 2; ^ shootings.cpp:118:28: error: 'f_shot' was not declared in this scope results[shot.id] = f_shot * f_shot / 2; ^ shootings.cpp: At global scope: shootings.cpp:122:107: error: '__int128_t' was not declared in this scope void solve_diag_right(int n, const std::vector<Rect>& rects, const std::vector<Query>& shots, std::vector<__int128_t>& results) { ^ shootings.cpp:122:117: error: template argument 1 is invalid void solve_diag_right(int n, const std::vector<Rect>& rects, const std::vector<Query>& shots, std::vector<__int128_t>& results) { ^ shootings.cpp:122:117: error: template argument 2 is invalid shootings.cpp: In function 'void solve_diag_right(int, const std::vector<Rect>&, const std::vector<Query>&, int&)': shootings.cpp:142:5: error: '__int128_t' was not declared in this scope __int128_t current_f = 2LL * n * last_p + 2LL * sum_y2_x1; ^ shootings.cpp:142:16: error: expected ';' before 'current_f' __int128_t current_f = 2LL * n * last_p + 2LL * sum_y2_x1; ^ shootings.cpp:147:13: error: 'current_f' was not declared in this scope current_f += (__int128_t)current_slope * (events[event_idx].p - last_p); ^ shootings.cpp:147:38: error: expected ';' before 'current_slope' current_f += (__int128_t)current_slope * (events[event_idx].p - last_p); ^ shootings.cpp:152:20: error: expected ';' before 'f_shot' __int128_t f_shot = current_f + (__int128_t)current_slope * (shot.p - last_p); ^ shootings.cpp:153:24: error: invalid types 'int[const int]' for array subscript results[shot.id] = f_shot * f_shot / 2; ^ shootings.cpp:153:28: error: 'f_shot' was not declared in this scope results[shot.id] = f_shot * f_shot / 2; ^ shootings.cpp: In function 'int main()': shootings.cpp:184:17: error: '__int128_t' was not declared in this scope std::vector<__int128_t> results(t); ^ shootings.cpp:184:27: error: template argument 1 is invalid std::vector<__int128_t> results(t); ^ shootings.cpp:184:27: error: template argument 2 is invalid shootings.cpp:184:36: error: invalid type in declaration before '(' token std::vector<__int128_t> results(t); ^ shootings.cpp:190:26: error: invalid types 'int[int]' for array subscript fout << results[i] << "\n"; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema shootings 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ă.