제출 #121234

#제출 시각아이디문제언어결과실행 시간메모리
121234miguelSure Bet (CEOI17_sure)C++14
60 / 100
2033 ms3424 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<double> #define pb push_back #define INF 1e9+7 int n; vi a, b; int main(){ cin>>n; //random_device dev; //mt19937 rng(dev()); //uniform_int_distribution<std::mt19937::result_type> dist6(5,6); //srand((unsigned)time(0)); //int i; //i=(rand()%2)+5; a.pb(INF); b.pb(INF); for(int i=1; i<=n; i++){ double x,y; cin>>x>>y; a.pb(x); b.pb(y); } sort(a.begin(), a.end(), greater<double>()); sort(b.begin(), b.end(), greater<double>()); //for(int i=1; i<=n; i++) cout<<a[i]<<" ";cout<<endl; a[0]=0; b[0]=0; for(int i=1; i<=n; i++){ a[i]+=a[i-1]; } for(int i=1; i<=n; i++){ b[i]+=b[i-1]; } int x=0, y=0; double mx=0; for(int i=0; i<=n; i++){ for(int j=0; j<=n; j++){ int t=i+j; mx=max(min(a[i]-t, b[j]-t), mx);//cout<<min(a[i]-t, b[j]-t)<<" "<<i<<" "<<j<<endl; } } printf("%.4lf",(double)mx); }

컴파일 시 표준 에러 (stderr) 메시지

sure.cpp: In function 'int main()':
sure.cpp:35:9: warning: unused variable 'x' [-Wunused-variable]
     int x=0, y=0; double mx=0;
         ^
sure.cpp:35:14: warning: unused variable 'y' [-Wunused-variable]
     int x=0, y=0; double mx=0;
              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...