Submission #1028268

#TimeUsernameProblemLanguageResultExecution timeMemory
1028268vjudge1Sure Bet (CEOI17_sure)C++17
60 / 100
2037 ms4720 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #pragma GCC target("popcnt") #define endl '\n' #define mp make_pair #define pb push_back #define fi first #define se second #define fo(i,n) for(auto i =0 ; i < n;i++) #define fore(i,l,r) for(auto i = l; i < r;i++) #define forex(i,r,l) for(auto i = r; i >= l; i--) #define ffo(i,n) forex(i,n-1,0) #define all(x) x.begin(),x.end() #define lsb(x) x&(-x) #define sz(x) (int)x.size() #define gcd(a,b) __gcd(a,b) #define vii vector<ii> #define pq_min(a) priority_queue<a, vector<a>, greater<a>> #define fls cout.flush() using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using ii = pair<int,int>; using mii = map<int,int>; using lld = long double; void valid(ll in){cout<<((in)?"YES\n":"NO\n");} void test_case(){ int n; cin >> n; lld a[n]{}, b[n]{}; fo(i,n)cin >> a[i] >> b[i]; sort(a,a+n); sort(b,b+n); lld ans = 0; lld sa=0; for(int i = 0; i <= n; i++){ if(i)sa += a[n-i]; lld sb=0; for(int j = 0; j <= n; j++){ if(j)sb += b[n-j]; ans = max(ans, min(sa,sb) - i - j); } } cout << ans << endl; } int main(){cin.tie(0)->sync_with_stdio(0); cout<<setprecision(4)<<fixed; int t=1; // cin >> t; while(t--)test_case(); }

Compilation message (stderr)

sure.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    4 | #pragma GCC optimization ("O3")
      | 
sure.cpp:5: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    5 | #pragma GCC optimization ("unroll-loops")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...