Submission #372772

#TimeUsernameProblemLanguageResultExecution timeMemory
372772cpp219코알라 (JOI13_koala)C++14
20 / 100
2077 ms4460 KiB
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second using namespace std; typedef pair<ll,ll> LL; const ll N = 1e5 + 9; const ll inf = 1e18 + 7; LL a[N]; ll K,M,D,A,n,dp[N]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "tst" if (fopen(task".INP","r")){ freopen(task".INP","r",stdin); //freopen(task".OUT","w",stdout); } cin>>K>>M>>D>>A>>n; a[1].fs = K; a[n + 2].fs = M; n += 2; for (ll i = 2;i < n;i++) cin>>a[i].fs>>a[i].sc; for (ll i = n - 1;i > 0;i--){ dp[i] = -inf; for (ll j = i + 1;j <= n;j++){ ll dis = a[j].fs - a[i].fs; ll kq = dp[j] + a[j].sc - A * ceil((ld)dis/D); dp[i] = max(dp[i],kq); } } cout<<dp[1]; }

Compilation message (stderr)

koala.cpp:2: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    2 | #pragma GCC optimization ("O3")
      | 
koala.cpp:3: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      | 
koala.cpp: In function 'int main()':
koala.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   23 |         freopen(task".INP","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...