Pagini recente » Borderou de evaluare (job #2264255) | Borderou de evaluare (job #2098407) | Borderou de evaluare (job #2141993) | Borderou de evaluare (job #751836) | Borderou de evaluare (job #1143607)
Borderou de evaluare (job #1143607)
Raport evaluator
Compilare:
user.cpp: In function ‘void apm(int)’:
user.cpp:12:424: warning: unused variable ‘c’ [-Wunused-variable]
ifstream fin("desen.in"); ofstream fout("desen.out"); int n, m, t[N], nrm; double sol; typedef pair <short, short> muchie; typedef pair <double, muchie> arbore; list <arbore> graf; list <bool> viz; vector <muchie> nod; inline double cost(int x, int y, int a, int b) { double dx = a-x, dy = b - y; return sqrt(dx*dx + dy*dy); } inline int tata(int x) { if(t[x] != x) t[x] = tata(t[x]); return t[x]; } void apm(int nn) { int c = -1; list <arbore> :: iterator it = graf.begin(); list <bool> :: iterator it2 = viz.begin(); for( ; nrm < nn; it++, it2++) { int x = tata((*it).aa), y = tata((*it).bb); if(x != y) { (*it2) = 1; t[x] = y; sol += (*it).first; nrm++; } } } void Erase() { list <arbore> :: iterator it = graf.begin(); list <bool> :: iterator it2 = viz.begin(); for(; it != graf.end(); ) { if(!(*it2)) { it = graf.erase(it); it2 = viz.erase(it2); } else { *it2 = 0; it++, it2++; } } } int main() { fin>>n; for(int i=0; i<n; i++) { short x, y; fin>>x>>y; nod.push_back(muchie(x, y)); Erase(); for(unsigned j=0; j<nod.size()-1; j++) { double c = cost(x, y, nod[j].first, nod[j].second); graf.push_back(arbore(c, muchie(i, j))); viz.push_back(0); } for(int k=0; k<=i; k++) t[k] = k; sol = nrm = 0; graf.sort(); apm(i); fout<<fixed<<sol<<setprecision(6)<<'\n'; } return 0; }
^
Test |
Timp executie |
Memorie folosita |
Mesaj |
Punctaj/test |
1 | 0ms | 456kb | OK! | 10 |
2 | 4ms | 464kb | OK! | 10 |
3 | 4ms | 460kb | OK! | 10 |
4 | 72ms | 508kb | OK! | 10 |
5 | 296ms | 548kb | OK! | 10 |
6 | 296ms | 548kb | OK! | 10 |
7 | 296ms | 548kb | OK! | 10 |
8 | 300ms | 548kb | OK! | 10 |
9 | 300ms | 548kb | OK! | 10 |
10 | 296ms | 548kb | OK! | 10 |
Punctaj total | 100 |