# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1072321 | 2024-08-23T17:01:53 Z | _rain_ | Let's Win the Election (JOI22_ho_t3) | C++14 | 2500 ms | 604 KB |
#include<bits/stdc++.h> using namespace std; #define ll long long #define fixbug true void SETIO(string name = ""){ if (name=="") return; freopen((name+".inp").c_str(),"r",stdin); freopen((name+".ans").c_str(),"w+",stdout); return; } const int maxn = 500; const int maxk = 500; const int INF = 1e9 + 7; int n , k ; pair<double,double> a[maxn+2]; #define fi first #define se second bool f[maxn+2]; vector<pair<int,int>> v; double ans = INF; vector<pair<int,int>> store; void calc(int id){ if (id==k+1){ double cnt = 1 ; double sum = 0; for (int i = 0; i < v.size(); ++i){ if (v[i].se == 1) { sum = sum + a[v[i].fi].fi / cnt; } else { sum = sum + a[v[i].fi].se / cnt; ++cnt; } } ans = min(ans , sum); return; } for (int i = 0; i < n; ++i){ if (!f[i]){ f[i] = 1; if (a[i].se != -1){ v.push_back({i,0}); calc(id+1); v.pop_back(); } v.push_back({i,1}); calc(id+1); v.pop_back(); f[i] = 0; } } return; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); SETIO(""); cin >> n >> k; for (int i = 0; i < n; ++i) { cin >> a[i].fi >> a[i].se; if (a[i].se==-1) a[i].se = INF; } calc(1); cout << setprecision(9) << fixed << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 460 KB | Output is correct |
5 | Execution timed out | 2519 ms | 348 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 460 KB | Output is correct |
5 | Execution timed out | 2519 ms | 348 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 7 ms | 464 KB | Output is correct |
7 | Correct | 16 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 348 KB | Output is correct |
9 | Correct | 2 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 2 ms | 348 KB | Output is correct |
12 | Correct | 2 ms | 348 KB | Output is correct |
13 | Correct | 2 ms | 604 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 16 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 7 ms | 464 KB | Output is correct |
7 | Correct | 16 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 348 KB | Output is correct |
9 | Correct | 2 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 2 ms | 348 KB | Output is correct |
12 | Correct | 2 ms | 348 KB | Output is correct |
13 | Correct | 2 ms | 604 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 16 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Execution timed out | 2561 ms | 348 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 7 ms | 464 KB | Output is correct |
7 | Correct | 16 ms | 344 KB | Output is correct |
8 | Correct | 2 ms | 348 KB | Output is correct |
9 | Correct | 2 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 2 ms | 348 KB | Output is correct |
12 | Correct | 2 ms | 348 KB | Output is correct |
13 | Correct | 2 ms | 604 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 16 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Execution timed out | 2561 ms | 348 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2547 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 460 KB | Output is correct |
5 | Execution timed out | 2519 ms | 348 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |