Submission #853056

#TimeUsernameProblemLanguageResultExecution timeMemory
853056mkorzybskiLet's Win the Election (JOI22_ho_t3)C++17
11 / 100
2540 ms1048576 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pii pair<ll,ll> #define f first #define s second ll n, k; const ll N = 507; ll A[N], B[N]; ld minWynik = (ld) 10000000; vector <vector<pii>> maskiV; void maski(ll bit, ll rozm, vector <pii> x) { if(bit > rozm) maskiV.push_back(x); for(ll i=1; i<=n; i++) { bool nieMa = true; for(pii v : x) if(v.f == i) nieMa = false; if(!nieMa) continue; x.push_back({i,1}); maski(bit+1, rozm, x); if(B[i] != -1) { x[bit-1].s = 2; maski(bit+1, rozm, x); } x.erase(x.begin() + bit-1); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k; for(ll i=1; i<=n; i++) { cin >> A[i] >> B[i]; } vector <pii> tmpV; maski(1, k, tmpV); /*ll licznik = 0; for(vector <pii> x : maskiV) { cout << endl << ++licznik << endl; for(pii v : x) cout << v.f << ',' << v.s << " "; }*/ for(vector <pii> x : maskiV) { ld wynik = 0; ld wsp = 1; for(pii v : x) { if(v.s == 1) { wynik += (ld) A[v.f] / wsp; } else { wynik += (ld) B[v.f] / wsp; wsp += 1; } } if(wynik == -1) { cout << endl; for(pii v : x) { cout << v.f << "," << v.s << " "; } cout << endl << wynik; } minWynik = min(minWynik, wynik); } cout << fixed << setprecision(7) << minWynik; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...