Submission #1116616

#TimeUsernameProblemLanguageResultExecution timeMemory
1116616shidou26Sure Bet (CEOI17_sure)C++14
20 / 100
7 ms592 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define all(v) v.begin(), v.end() #define dbg(v) "[" #v " = " << (v) << "]" template<typename T> bool maximize(T &a, T b) { if(a < b) { a = b; return true; }else return false; } template<typename T> bool minimize(T &a, T b) { if(a > b) { a = b; return true; }else return false; } typedef long long ll; typedef pair<int, int> ii; typedef pair<ll, int> li; const int N = 1e5 + 3; int n; double a[N], b[N]; namespace subtask1 { double best = 0; void backtrack(int p, double totalA, double totalB, int counter) { if(p > n) { maximize(best, min(totalA - (double)counter, totalB - (double)counter)); return; } backtrack(p + 1, totalA, totalB, counter); backtrack(p + 1, totalA + a[p], totalB, counter + 1); backtrack(p + 1, totalA, totalB + b[p], counter + 1); backtrack(p + 1, totalA + a[p], totalB + b[p], counter + 2); } void solve() { backtrack(1, 0, 0, 0); cout << fixed << setprecision(4) << best << endl; } }; namespace subtask2 { double dpOne[N][5]; void solve() { } } void process() { if(n <= 10) { subtask1::solve(); return; } assert(1 == 0); } void input() { cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i] >> b[i]; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); #define task "DateALive" if(fopen(task".INP", "r")) { freopen(task".INP", "r", stdin); freopen(task".OUT", "w", stdout); } input(); process(); return 0; }

Compilation message (stderr)

sure.cpp: In function 'int main()':
sure.cpp:81:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   81 |   freopen(task".INP", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sure.cpp:82:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   82 |   freopen(task".OUT", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...