제출 #678576

#제출 시각아이디문제언어결과실행 시간메모리
678576flappybirdSure Bet (CEOI17_sure)C++17
100 / 100
78 ms3620 KiB
#include <bits/stdc++.h> #include <cassert> #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,fma") using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define MAX 101010 #define MAXS 20 #define INF 1000000000000000001 #define bb ' ' #define ln '\n' #define Ln '\n' double A[MAX]; double B[MAX]; signed main() { ios::sync_with_stdio(false), cin.tie(0); int N; cin >> N; int i; double a, b; for (i = 1; i <= N; i++) { cin >> A[i] >> B[i]; } sort(A + 1, A + N + 1); sort(B + 1, B + N + 1); double sa, sb; int pa, pb; pa = pb = N; double ans = 0; sa = sb = 0; for (i = 1; i <= 2 * N; i++) { if ((sa < sb && pa) || !pb) { sa += A[pa]; pa--; } else { sb += B[pb]; pb--; } ans = max(ans, min(sa, sb) - i); } cout << fixed; cout.precision(4); cout << ans << ln; }

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

sure.cpp: In function 'int main()':
sure.cpp:24:9: warning: unused variable 'a' [-Wunused-variable]
   24 |  double a, b;
      |         ^
sure.cpp:24:12: warning: unused variable 'b' [-Wunused-variable]
   24 |  double a, b;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...