#1101
Project Management
La o firmă de software se lucrează la un mare proiect. Proiectul constă în executarea a n
(n
număr natural) faze de dezvoltare, numerotate cu numerele 1
, 2
, …, n
. Unele faze pot fi executate în paralel (în acelaşi timp), însă executarea altor faze nu poate fi începută până când nu se finalizează executarea anumitor faze.
Să se scrie un program care să se determine:
a) timpul minim t
în care se poate finaliza executarea proiectului
b) pentru fiecare fază k
(k
din {1,2,…,n}
), momentul de timp c
k
la care poate începe faza k
cel mai devreme, respectiv momentul de timp d
k
la care poate începe faza k
cel mai târziu, fără a influenţa durata totală de executare a proiectului.
OJI 2009, Clasele XI-XII
Problema | Project Management | Operații I/O |
pm.in /pm.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54800657 | Utilizator | |
Fișier | project_management.cpp | Dimensiune | 1.74 KB |
Data încărcării | 09 Decembrie 2024, 10:03 | Scor / rezultat | Eroare de compilare |
project_management.cpp: In function 'void TopSort()': project_management.cpp:23:24: error: no matching function for call to 'std::set<std::pair<int, int> >::erase(int&)' s.erase(x.first); ^ project_management.cpp:23:24: note: candidates are: In file included from /usr/include/c++/4.8/set:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:86, from project_management.cpp:1: /usr/include/c++/4.8/bits/stl_set.h:551:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >] erase(const_iterator __position) ^ /usr/include/c++/4.8/bits/stl_set.h:551:7: note: no known conversion for argument 1 from 'int' to 'std::set<std::pair<int, int> >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' /usr/include/c++/4.8/bits/stl_set.h:581:7: note: std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::size_type = unsigned int; std::set<_Key, _Compare, _Alloc>::key_type = std::pair<int, int>] erase(const key_type& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:581:7: note: no known conversion for argument 1 from 'int' to 'const key_type& {aka const std::pair<int, int>&}' /usr/include/c++/4.8/bits/stl_set.h:603:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >] erase(const_iterator __first, const_iterator __last) ^ /usr/include/c++/4.8/bits/stl_set.h:603:7: note: candidate expects 2 arguments, 1 provided project_management.cpp:25:24: error: no match for 'operator[]' (operand types are 'std::vector<int> [105]' and 'std::pair<int, int>') for (auto y : A[x]){ ^ project_management.cpp: At global scope: project_management.cpp:60:13: error: redefinition of 'std::ifstream fin' ifstream fin("pm.in"); ^ project_management.cpp:5:10: error: 'std::ifstream fin' previously declared here ifstream fin("pm.in"); ^ project_management.cpp:61:14: error: redefinition of 'std::ofstream fout' ofstream fout("pm.out"); ^ project_management.cpp:6:10: error: 'std::ofstream fout' previously declared here ofstream fout("pm.out"); ^ project_management.cpp:63:5: error: redefinition of 'int n' int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:8:5: error: 'int n' previously declared here int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:63:12: error: redefinition of 'int t [105]' int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:8:7: error: 'int t [105]' previously declared here int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:63:14: error: redefinition of 'int i' int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:8:14: error: 'int i' previously declared here int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:63:16: error: redefinition of 'int j' int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:8:16: error: 'int j' previously declared here int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:63:18: error: redefinition of 'int m' int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:8:18: error: 'int m' previously declared here int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:63:20: error: redefinition of 'int a' int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:8:20: error: 'int a' previously declared here int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:63:22: error: redefinition of 'int b' int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:8:22: error: 'int b' previously declared here int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:63:30: error: redefinition of 'int dp [105]' int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:8:24: error: 'int dp [105]' previously declared here int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:63:39: error: redefinition of 'int deg [105]' int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:8:32: error: 'int deg [105]' previously declared here int n,t[105],i,j,m,a,b,dp[105],deg[105]; ^ project_management.cpp:64:15: error: redefinition of 'std::pair<int, int> x' pair<int,int> x; ^ project_management.cpp:9:15: error: 'std::pair<int, int> x' previously defined here pair<int,int> x; ^ project_management.cpp:65:18: error: redefinition of 'std::vector<int> A [105]' vector<int> A[105]; ^ project_management.cpp:10:13: error: 'std::vector<int> A [105]' previously declared here vector<int> A[105]; ^ project_management.cpp:66:22: error: redefinition of 'std::set<std::pair<int, int> > s' set< pair<int,int> > s; ^ project_management.cpp:11:22: error: 'std::set<std::pair<int, int> > s' previously declared here set< pair<int,int> > s; ^ project_management.cpp:67:12: error: redefinition of 'std::deque<int> order' deque<int> order; ^ project_management.cpp:12:12: error: 'std::deque<int> order' previously declared here deque<int> order; ^ project_management.cpp: In function 'void TopSort()': project_management.cpp:69:6: error: redefinition of 'void TopSort()' void TopSort(){ ^ project_management.cpp:14:6: error: 'void TopSort()' previously defined here void TopSort(){ ^ project_management.cpp:78:24: error: no matching function for call to 'std::set<std::pair<int, int> >::erase(int&)' s.erase(x.first); ^ project_management.cpp:78:24: note: candidates are: In file included from /usr/include/c++/4.8/set:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:86, from project_management.cpp:1: /usr/include/c++/4.8/bits/stl_set.h:551:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >] erase(const_iterator __position) ^ /usr/include/c++/4.8/bits/stl_set.h:551:7: note: no known conversion for argument 1 from 'int' to 'std::set<std::pair<int, int> >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' /usr/include/c++/4.8/bits/stl_set.h:581:7: note: std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::size_type = unsigned int; std::set<_Key, _Compare, _Alloc>::key_type = std::pair<int, int>] erase(const key_type& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:581:7: note: no known conversion for argument 1 from 'int' to 'const key_type& {aka const std::pair<int, int>&}' /usr/include/c++/4.8/bits/stl_set.h:603:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >] erase(const_iterator __first, const_iterator __last) ^ /usr/include/c++/4.8/bits/stl_set.h:603:7: note: candidate expects 2 arguments, 1 provided project_management.cpp:80:24: error: no match for 'operator[]' (operand types are 'std::vector<int> [105]' and 'std::pair<int, int>') for (auto y : A[x]){ ^ project_management.cpp: In function 'int main()': project_management.cpp:89:5: error: redefinition of 'int main()' int main() ^ project_management.cpp:34:5: error: 'int main()' previously defined here int main() ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Project Management 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ă.