# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
372772 | 2021-03-01T15:16:43 Z | cpp219 | 코알라 (JOI13_koala) | C++14 | 2000 ms | 4460 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 364 KB | Output is correct |
3 | Correct | 3 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 3 ms | 364 KB | Output is correct |
6 | Correct | 4 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 4 ms | 364 KB | Output is correct |
9 | Correct | 4 ms | 364 KB | Output is correct |
10 | Correct | 4 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2077 ms | 4460 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2070 ms | 4204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |