답안 #936922

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
936922 2024-03-03T03:41:36 Z Marco_Escandon Let's Win the Election (JOI22_ho_t3) C++11
5 / 100
2012 ms 9044 KB
#include<bits/stdc++.h>
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout.setf(ios::fixed);cout.precision(3);
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
#define x first
#define y second
pair<double,double> cad[501];
pair<double,double> dp[3][503][503];
int main()
{
    optimizar_io
    ll n,m;
    cin>>n>>m;
    cad[0]={-1,-1};
    for(int i=1; i<=n; i++)
        cin>>cad[i].second>>cad[i].first;
    sort(cad,cad+n);
    for(int i=0; i<2; i++)
        for(int j=0; j<=m+2; j++)
            for(int k=0; k<=m+2; k++)
                dp[i][j][k]={1e9,1e9};
    dp[0][1][1]={0,0};
    double bs=1e9;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m+1; j++)
        {
            for(int k=1; k<=m+1; k++)
            {
                pair<double,double> temp={1e9,1e9};
                temp=min(temp,dp[0][j][k]);
                temp=min(temp,{dp[0][j][k-1].x+cad[i].y/j,dp[0][j][k-1].y});
                if(cad[i].first!=-1&&j!=1)
                    temp=min(temp,{(dp[0][j-1][k-1].x-dp[0][j-1][k-1].y)*(j-1)/j+dp[0][j-1][k-1].y+cad[i].x/(j-1),dp[0][j-1][k-1].y+cad[i].x/(j-1)});
                dp[1][j][k]=temp;
                if(k==m+1) bs=min(bs,dp[1][j][k].first);
            }
            //cout<<"\n";
        }
        swap(dp[0],dp[1]);
        //cout<<"\n\n";
    }
    cout<<bs;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 8284 KB Output is correct
2 Correct 4 ms 8240 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Correct 4 ms 8284 KB Output is correct
5 Correct 182 ms 8368 KB Output is correct
6 Correct 254 ms 8284 KB Output is correct
7 Correct 502 ms 8364 KB Output is correct
8 Correct 892 ms 9044 KB Output is correct
9 Correct 1449 ms 8832 KB Output is correct
10 Correct 805 ms 8832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 8284 KB Output is correct
2 Correct 4 ms 8240 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Correct 4 ms 8284 KB Output is correct
5 Correct 182 ms 8368 KB Output is correct
6 Correct 254 ms 8284 KB Output is correct
7 Correct 502 ms 8364 KB Output is correct
8 Correct 892 ms 9044 KB Output is correct
9 Correct 1449 ms 8832 KB Output is correct
10 Correct 805 ms 8832 KB Output is correct
11 Correct 3 ms 8284 KB Output is correct
12 Correct 336 ms 8368 KB Output is correct
13 Correct 312 ms 8280 KB Output is correct
14 Correct 294 ms 8368 KB Output is correct
15 Correct 1080 ms 9044 KB Output is correct
16 Correct 961 ms 8844 KB Output is correct
17 Correct 842 ms 8796 KB Output is correct
18 Incorrect 1966 ms 8836 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8280 KB Output is correct
2 Correct 5 ms 8280 KB Output is correct
3 Correct 5 ms 8280 KB Output is correct
4 Correct 5 ms 8380 KB Output is correct
5 Correct 5 ms 8280 KB Output is correct
6 Correct 5 ms 8280 KB Output is correct
7 Correct 5 ms 8280 KB Output is correct
8 Correct 5 ms 8284 KB Output is correct
9 Correct 5 ms 8280 KB Output is correct
10 Correct 5 ms 8284 KB Output is correct
11 Correct 5 ms 8340 KB Output is correct
12 Correct 5 ms 8536 KB Output is correct
13 Correct 7 ms 8284 KB Output is correct
14 Incorrect 5 ms 8384 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8280 KB Output is correct
2 Correct 5 ms 8280 KB Output is correct
3 Correct 5 ms 8280 KB Output is correct
4 Correct 5 ms 8380 KB Output is correct
5 Correct 5 ms 8280 KB Output is correct
6 Correct 5 ms 8280 KB Output is correct
7 Correct 5 ms 8280 KB Output is correct
8 Correct 5 ms 8284 KB Output is correct
9 Correct 5 ms 8280 KB Output is correct
10 Correct 5 ms 8284 KB Output is correct
11 Correct 5 ms 8340 KB Output is correct
12 Correct 5 ms 8536 KB Output is correct
13 Correct 7 ms 8284 KB Output is correct
14 Incorrect 5 ms 8384 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8280 KB Output is correct
2 Correct 5 ms 8280 KB Output is correct
3 Correct 5 ms 8280 KB Output is correct
4 Correct 5 ms 8380 KB Output is correct
5 Correct 5 ms 8280 KB Output is correct
6 Correct 5 ms 8280 KB Output is correct
7 Correct 5 ms 8280 KB Output is correct
8 Correct 5 ms 8284 KB Output is correct
9 Correct 5 ms 8280 KB Output is correct
10 Correct 5 ms 8284 KB Output is correct
11 Correct 5 ms 8340 KB Output is correct
12 Correct 5 ms 8536 KB Output is correct
13 Correct 7 ms 8284 KB Output is correct
14 Incorrect 5 ms 8384 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2012 ms 8832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 8284 KB Output is correct
2 Correct 4 ms 8240 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Correct 4 ms 8284 KB Output is correct
5 Correct 182 ms 8368 KB Output is correct
6 Correct 254 ms 8284 KB Output is correct
7 Correct 502 ms 8364 KB Output is correct
8 Correct 892 ms 9044 KB Output is correct
9 Correct 1449 ms 8832 KB Output is correct
10 Correct 805 ms 8832 KB Output is correct
11 Correct 3 ms 8284 KB Output is correct
12 Correct 336 ms 8368 KB Output is correct
13 Correct 312 ms 8280 KB Output is correct
14 Correct 294 ms 8368 KB Output is correct
15 Correct 1080 ms 9044 KB Output is correct
16 Correct 961 ms 8844 KB Output is correct
17 Correct 842 ms 8796 KB Output is correct
18 Incorrect 1966 ms 8836 KB Output isn't correct
19 Halted 0 ms 0 KB -