답안 #879275

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
879275 2023-11-27T05:16:32 Z vjudge1 Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 26716 KB
#include <bits/stdc++.h>
 
using namespace std;
  
typedef long long ll;
 
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma optimization_level 3
  
// Defines
  
#define pb push_back // kak push_back 5
#define endl '\n'
#define FOR(i,start,end) for(int i = start;i < end;i ++)
#define REV(i,start,end) for(int i = start;i >= end;i --)
#define precal(x) fixed << setprecision(x)
#define F first
#define S second
#define sz(x) (ll)x.size()
#define all(x) (x).begin(),(x).end()
#define m_p make_pair
#define mt make_tuple
#define str to_string
 
// #ifndef ONLINE_JUDGE
//     #define cerr if(false) cerr
// #endif
  
const ll mxn = 1e6 + 1;
// const ll k = 400;
// const ll org = 10000;
const ll inf = 1e9 + 7;
// const ll mod = 998244353;
 
ll n,m,t[4 * mxn],a[mxn];
 
bool au,us[mxn];

ll used[mxn];
 
vector <ll> v[mxn];

ll deg(ll x,ll p){
    ll ans = 1;
    while(p --) ans *= x;
    return ans;
}

int main(){
    // freopen("sparse.in","r",stdin);
    // freopen("sparse.out","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll tt = 1;
    // cin >> tt; 
    while(tt --){
        ll n;
        cin >> n;
        vector <double> a(n),b(n);
        FOR(i,0,n){
            cin >> a[i] >> b[i];
        }
        sort(a.rbegin(),a.rend()),sort(b.rbegin(),b.rend());
        double mx = 0.0,sum = 0.0;
        for(int i = 0;i < n;i ++){
            sum += a[i];
            double summ = 0.0;
            for(int j = 0;j < n;j ++){
                summ += b[j];
                mx = max(mx,min(sum,summ) - i - j - 2);
            }
        }
        cout << precal(4) << mx;
    }
}

Compilation message

sure.cpp:9: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    9 | #pragma GCC optimization ("O3")
      | 
sure.cpp:10: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   10 | #pragma GCC optimization ("unroll-loops")
      | 
sure.cpp:11: warning: ignoring '#pragma optimization_level ' [-Wunknown-pragmas]
   11 | #pragma optimization_level 3
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 25180 KB Output is correct
2 Correct 5 ms 25180 KB Output is correct
3 Correct 6 ms 25224 KB Output is correct
4 Correct 5 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 5 ms 25180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 25180 KB Output is correct
2 Correct 5 ms 25180 KB Output is correct
3 Correct 6 ms 25224 KB Output is correct
4 Correct 5 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 5 ms 25180 KB Output is correct
7 Correct 5 ms 25180 KB Output is correct
8 Correct 5 ms 25180 KB Output is correct
9 Correct 6 ms 25180 KB Output is correct
10 Correct 6 ms 25196 KB Output is correct
11 Correct 7 ms 25180 KB Output is correct
12 Correct 12 ms 25180 KB Output is correct
13 Correct 12 ms 25180 KB Output is correct
14 Correct 12 ms 25284 KB Output is correct
15 Correct 12 ms 25180 KB Output is correct
16 Correct 12 ms 25280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 25180 KB Output is correct
2 Correct 5 ms 25180 KB Output is correct
3 Correct 6 ms 25224 KB Output is correct
4 Correct 5 ms 25180 KB Output is correct
5 Correct 5 ms 25180 KB Output is correct
6 Correct 5 ms 25180 KB Output is correct
7 Correct 5 ms 25180 KB Output is correct
8 Correct 5 ms 25180 KB Output is correct
9 Correct 6 ms 25180 KB Output is correct
10 Correct 6 ms 25196 KB Output is correct
11 Correct 7 ms 25180 KB Output is correct
12 Correct 12 ms 25180 KB Output is correct
13 Correct 12 ms 25180 KB Output is correct
14 Correct 12 ms 25284 KB Output is correct
15 Correct 12 ms 25180 KB Output is correct
16 Correct 12 ms 25280 KB Output is correct
17 Execution timed out 2090 ms 26716 KB Time limit exceeded
18 Halted 0 ms 0 KB -