답안 #541768

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541768 2022-03-24T11:19:33 Z AdamGS Let's Win the Election (JOI22_ho_t3) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>using namespace std;typedef long long ll;typedef long double ld;#define rep(a, b) for(int a = 0; a < (b); ++a)#define st first#define nd second#define pb push_back#define all(a) a.begin(), a.end()const int LIM=507;const ld INF=1e9+7;pair<int,int>T[LIM];ld dp[LIM][LIM];int n, k;ld solve(int m) {  rep(i, n+1) rep(j, k+1) dp[i][j]=INF;  dp[0][0]=0;  for(int i=1; i<=n; ++i) {    for(int j=0; j<=i; ++j) {      int l=min(i-j, m);      if(j) {        ld x=T[i-1].nd; x/=m+1;        dp[i][j]=min(dp[i][j], dp[i-1][j-1]+x);      }      if(j<i) {        ld x=T[i-1].st; x/=l;        dp[i][j]=min(dp[i][j], dp[i-1][j]+x);        if(i-j>m) {          dp[i][j]=min(dp[i][j], dp[i-1][j]);        }      }    }  }  return dp[n][k-m];}int main() {  ios_base::sync_with_stdio(0); cin.tie(0);  cin >> n >> k;  rep(i, n) {    cin >> T[i].nd >> T[i].st;    if(T[i].st==-1) T[i].st=INF;  }  sort(T, T+n);  ld ans=INF;  rep(i, k+1) ans=min(ans, solve(i));  cout << fixed << setprecision(3) << ans << '\n';}

Compilation message

Main.cpp:1:30: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++.h>using namespace std;typedef long long ll;typedef long double ld;#define rep(a, b) for(int a = 0; a < (b); ++a)#define st first#define nd second#define pb push_back#define all(a) a.begin(), a.end()const int LIM=507;const ld INF=1e9+7;pair<int,int>T[LIM];ld dp[LIM][LIM];int n, k;ld solve(int m) {  rep(i, n+1) rep(j, k+1) dp[i][j]=INF;  dp[0][0]=0;  for(int i=1; i<=n; ++i) {    for(int j=0; j<=i; ++j) {      int l=min(i-j, m);      if(j) {        ld x=T[i-1].nd; x/=m+1;        dp[i][j]=min(dp[i][j], dp[i-1][j-1]+x);      }      if(j<i) {        ld x=T[i-1].st; x/=l;        dp[i][j]=min(dp[i][j], dp[i-1][j]+x);        if(i-j>m) {          dp[i][j]=min(dp[i][j], dp[i-1][j]);        }      }    }  }  return dp[n][k-m];}int main() {  ios_base::sync_with_stdio(0); cin.tie(0);  cin >> n >> k;  rep(i, n) {    cin >> T[i].nd >> T[i].st;    if(T[i].st==-1) T[i].st=INF;  }  sort(T, T+n);  ld ans=INF;  rep(i, k+1) ans=min(ans, solve(i));  cout << fixed << setprecision(3) << ans << '\n';}
      |                              ^~~~~~~~~
Main.cpp:1:9: fatal error: bits/stdc++.h>usin: No such file or directory
    1 | #include<bits/stdc++.h>using namespace std;typedef long long ll;typedef long double ld;#define rep(a, b) for(int a = 0; a < (b); ++a)#define st first#define nd second#define pb push_back#define all(a) a.begin(), a.end()const int LIM=507;const ld INF=1e9+7;pair<int,int>T[LIM];ld dp[LIM][LIM];int n, k;ld solve(int m) {  rep(i, n+1) rep(j, k+1) dp[i][j]=INF;  dp[0][0]=0;  for(int i=1; i<=n; ++i) {    for(int j=0; j<=i; ++j) {      int l=min(i-j, m);      if(j) {        ld x=T[i-1].nd; x/=m+1;        dp[i][j]=min(dp[i][j], dp[i-1][j-1]+x);      }      if(j<i) {        ld x=T[i-1].st; x/=l;        dp[i][j]=min(dp[i][j], dp[i-1][j]+x);        if(i-j>m) {          dp[i][j]=min(dp[i][j], dp[i-1][j]);        }      }    }  }  return dp[n][k-m];}int main() {  ios_base::sync_with_stdio(0); cin.tie(0);  cin >> n >> k;  rep(i, n) {    cin >> T[i].nd >> T[i].st;    if(T[i].st==-1) T[i].st=INF;  }  sort(T, T+n);  ld ans=INF;  rep(i, k+1) ans=min(ans, solve(i));  cout << fixed << setprecision(3) << ans << '\n';}
      |         ^~~~~~~~~~~~~~~~~~~~
compilation terminated.