Submission #833834

#TimeUsernameProblemLanguageResultExecution timeMemory
833834BilAktauAlmansurDivide and conquer (IZhO14_divide)C++17
48 / 100
1093 ms880 KiB
#include <bits/stdc++.h> #pragma optimize ("g",on) #pragma GCC optimize ("inline") #pragma GCC optimize ("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize ("03") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native") #pragma comment(linker, "/stack:200000000") // #define int long long using namespace std; const int N = 1e5 + 7; int n; pair<int, pair<int, int> > a[N]; signed main() { // freopen("bank.in", "r", stdin); // freopen("bank.out", "w", stdout); ios_base::sync_with_stdio(NULL); cin.tie(NULL); cin>>n; for(int i = 1; i <= n; i++) { int pos, d, x; cin>>pos>>d>>x; a[i].first = pos, a[i].second.first = d, a[i].second.second = x; } sort(a + 1, a + 1 + n); long long ans = 0; for(int i = 1; i <= n; i++) { long long sum_d = 0, sum_x = 0; for(int j = i; j <= n; j++) { sum_x += a[j].second.second, sum_d += a[j].second.first; int len = a[j].first - a[i].first; if(len <= sum_x) { // cout << i << ' ' << j << ' ' << len << ' ' << sum_x << '\n'; ans = max(ans, sum_d); } } } cout << ans << '\n'; }

Compilation message (stderr)

divide.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    2 | #pragma optimize ("g",on)
      | 
divide.cpp:8: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    8 | #pragma comment(linker, "/stack:200000000")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...