답안 #936919

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
936919 2024-03-03T03:35:44 Z Marco_Escandon Let's Win the Election (JOI22_ho_t3) C++11
5 / 100
1975 ms 9048 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(15);
#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 8280 KB Output is correct
2 Correct 4 ms 8536 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Correct 5 ms 8284 KB Output is correct
5 Correct 181 ms 8376 KB Output is correct
6 Correct 257 ms 8372 KB Output is correct
7 Correct 489 ms 8280 KB Output is correct
8 Correct 887 ms 9048 KB Output is correct
9 Correct 1457 ms 8836 KB Output is correct
10 Correct 799 ms 8836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 8280 KB Output is correct
2 Correct 4 ms 8536 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Correct 5 ms 8284 KB Output is correct
5 Correct 181 ms 8376 KB Output is correct
6 Correct 257 ms 8372 KB Output is correct
7 Correct 489 ms 8280 KB Output is correct
8 Correct 887 ms 9048 KB Output is correct
9 Correct 1457 ms 8836 KB Output is correct
10 Correct 799 ms 8836 KB Output is correct
11 Correct 3 ms 8280 KB Output is correct
12 Correct 334 ms 8372 KB Output is correct
13 Correct 319 ms 8528 KB Output is correct
14 Correct 330 ms 8280 KB Output is correct
15 Correct 1107 ms 8832 KB Output is correct
16 Correct 958 ms 8860 KB Output is correct
17 Correct 858 ms 9044 KB Output is correct
18 Incorrect 1969 ms 8836 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8284 KB Output is correct
2 Correct 5 ms 8284 KB Output is correct
3 Correct 5 ms 8280 KB Output is correct
4 Correct 5 ms 8172 KB Output is correct
5 Correct 5 ms 8284 KB Output is correct
6 Correct 5 ms 8332 KB Output is correct
7 Correct 6 ms 8280 KB Output is correct
8 Correct 5 ms 8280 KB Output is correct
9 Correct 8 ms 8284 KB Output is correct
10 Correct 5 ms 8284 KB Output is correct
11 Correct 6 ms 8256 KB Output is correct
12 Correct 5 ms 8284 KB Output is correct
13 Correct 6 ms 8280 KB Output is correct
14 Incorrect 5 ms 8280 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8284 KB Output is correct
2 Correct 5 ms 8284 KB Output is correct
3 Correct 5 ms 8280 KB Output is correct
4 Correct 5 ms 8172 KB Output is correct
5 Correct 5 ms 8284 KB Output is correct
6 Correct 5 ms 8332 KB Output is correct
7 Correct 6 ms 8280 KB Output is correct
8 Correct 5 ms 8280 KB Output is correct
9 Correct 8 ms 8284 KB Output is correct
10 Correct 5 ms 8284 KB Output is correct
11 Correct 6 ms 8256 KB Output is correct
12 Correct 5 ms 8284 KB Output is correct
13 Correct 6 ms 8280 KB Output is correct
14 Incorrect 5 ms 8280 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8284 KB Output is correct
2 Correct 5 ms 8284 KB Output is correct
3 Correct 5 ms 8280 KB Output is correct
4 Correct 5 ms 8172 KB Output is correct
5 Correct 5 ms 8284 KB Output is correct
6 Correct 5 ms 8332 KB Output is correct
7 Correct 6 ms 8280 KB Output is correct
8 Correct 5 ms 8280 KB Output is correct
9 Correct 8 ms 8284 KB Output is correct
10 Correct 5 ms 8284 KB Output is correct
11 Correct 6 ms 8256 KB Output is correct
12 Correct 5 ms 8284 KB Output is correct
13 Correct 6 ms 8280 KB Output is correct
14 Incorrect 5 ms 8280 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1975 ms 8836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 8280 KB Output is correct
2 Correct 4 ms 8536 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Correct 5 ms 8284 KB Output is correct
5 Correct 181 ms 8376 KB Output is correct
6 Correct 257 ms 8372 KB Output is correct
7 Correct 489 ms 8280 KB Output is correct
8 Correct 887 ms 9048 KB Output is correct
9 Correct 1457 ms 8836 KB Output is correct
10 Correct 799 ms 8836 KB Output is correct
11 Correct 3 ms 8280 KB Output is correct
12 Correct 334 ms 8372 KB Output is correct
13 Correct 319 ms 8528 KB Output is correct
14 Correct 330 ms 8280 KB Output is correct
15 Correct 1107 ms 8832 KB Output is correct
16 Correct 958 ms 8860 KB Output is correct
17 Correct 858 ms 9044 KB Output is correct
18 Incorrect 1969 ms 8836 KB Output isn't correct
19 Halted 0 ms 0 KB -