Submission #533454
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, a) REP(i, 0, a) #define EACH(i, a) for (auto i: a) #define ITR(x, a) for (__typeof(a.begin()) x = a.begin(); x != a.end(); x++) #define ALL(a) (a.begin()), (a.end()) #define HAS(a, x) (a.find(x) != a.end()) #define endl '\n' int N; ll A[100005]; ll B[100005]; int main(void) { cin >> N; rep(i, N) cin >> A[i]; rep(i, N) cin >> B[i]; ll money = 0; int pos = 0; ll ans = B[0] * N; REP(day, 1, N) { if (pos + 1 < N && money + A[pos] >= 0) { money += A[pos]; pos++; ll mx = 0; rep(i, pos + 1) mx = max(mx, B[i]); ans = max(ans, money + mx * (N - day)); } else { money += B[pos]; } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - 高橋君の旅行 |
User | roiti |
Language | C++11 (GCC 4.9.2) |
Score | 0 |
Code Size | 871 Byte |
Status | WA |
Exec Time | 2035 ms |
Memory | 2520 KB |
Judge Result
Set Name | Small | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 3 | 0 / 197 | ||||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Small | 00_small_sample_00.txt, 00_small_sample_01.txt, 00_small_sample_02.txt, 00_small_sample_03.txt, 10_small_01.txt, 10_small_02.txt, 10_small_03.txt, 10_small_04.txt, 10_small_05.txt, 10_small_06.txt, 90_small_teuchi_00.txt, 90_small_teuchi_01.txt, 90_small_teuchi_02.txt |
All | 00_small_sample_00.txt, 00_small_sample_01.txt, 00_small_sample_02.txt, 00_small_sample_03.txt, 10_small_01.txt, 10_small_02.txt, 10_small_03.txt, 10_small_04.txt, 10_small_05.txt, 10_small_06.txt, 20_large_01.txt, 20_large_02.txt, 20_large_03.txt, 20_large_04.txt, 20_large_05.txt, 20_large_06.txt, 20_large_07.txt, 20_large_08.txt, 20_large_09.txt, 20_large_10.txt, 20_large_11.txt, 20_large_12.txt, 20_large_13.txt, 20_large_14.txt, 20_large_15.txt, 20_large_16.txt, 20_large_17.txt, 20_large_18.txt, 20_large_19.txt, 20_large_20.txt, 20_large_21.txt, 20_large_22.txt, 20_large_23.txt, 20_large_24.txt, 20_large_25.txt, 20_large_26.txt, 20_large_27.txt, 20_large_28.txt, 20_large_29.txt, 20_large_30.txt, 30_run_through_01.txt, 70_maximum_01.txt, 80_hand_01.txt, 80_hand_02.txt, 80_hand_03.txt, 80_hand_04.txt, 90_small_teuchi_00.txt, 90_small_teuchi_01.txt, 90_small_teuchi_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_small_sample_00.txt | AC | 27 ms | 896 KB |
00_small_sample_01.txt | AC | 26 ms | 928 KB |
00_small_sample_02.txt | AC | 26 ms | 924 KB |
00_small_sample_03.txt | AC | 26 ms | 808 KB |
10_small_01.txt | WA | 26 ms | 932 KB |
10_small_02.txt | AC | 26 ms | 924 KB |
10_small_03.txt | AC | 26 ms | 932 KB |
10_small_04.txt | AC | 26 ms | 928 KB |
10_small_05.txt | AC | 26 ms | 928 KB |
10_small_06.txt | AC | 25 ms | 928 KB |
20_large_01.txt | AC | 154 ms | 2360 KB |
20_large_02.txt | WA | 492 ms | 2360 KB |
20_large_03.txt | WA | 598 ms | 2396 KB |
20_large_04.txt | AC | 153 ms | 2356 KB |
20_large_05.txt | WA | 585 ms | 2356 KB |
20_large_06.txt | WA | 791 ms | 2356 KB |
20_large_07.txt | AC | 155 ms | 2420 KB |
20_large_08.txt | WA | 521 ms | 2388 KB |
20_large_09.txt | WA | 583 ms | 2352 KB |
20_large_10.txt | WA | 151 ms | 2360 KB |
20_large_11.txt | TLE | 2033 ms | 2472 KB |
20_large_12.txt | TLE | 2035 ms | 2480 KB |
20_large_13.txt | WA | 572 ms | 2356 KB |
20_large_14.txt | TLE | 2034 ms | 2488 KB |
20_large_15.txt | TLE | 2035 ms | 2484 KB |
20_large_16.txt | TLE | 2033 ms | 2388 KB |
20_large_17.txt | TLE | 2034 ms | 2484 KB |
20_large_18.txt | TLE | 2033 ms | 2484 KB |
20_large_19.txt | TLE | 2034 ms | 2484 KB |
20_large_20.txt | TLE | 2032 ms | 2460 KB |
20_large_21.txt | TLE | 2032 ms | 2488 KB |
20_large_22.txt | TLE | 2033 ms | 2488 KB |
20_large_23.txt | TLE | 2033 ms | 2476 KB |
20_large_24.txt | TLE | 2034 ms | 2468 KB |
20_large_25.txt | TLE | 2033 ms | 2484 KB |
20_large_26.txt | TLE | 2033 ms | 2484 KB |
20_large_27.txt | TLE | 2034 ms | 2460 KB |
20_large_28.txt | TLE | 2032 ms | 2488 KB |
20_large_29.txt | TLE | 2033 ms | 2488 KB |
20_large_30.txt | TLE | 2035 ms | 2452 KB |
30_run_through_01.txt | TLE | 2034 ms | 2488 KB |
70_maximum_01.txt | TLE | 2035 ms | 2520 KB |
80_hand_01.txt | TLE | 2034 ms | 2488 KB |
80_hand_02.txt | TLE | 2032 ms | 2460 KB |
80_hand_03.txt | TLE | 2034 ms | 2484 KB |
80_hand_04.txt | TLE | 2034 ms | 2508 KB |
90_small_teuchi_00.txt | AC | 26 ms | 920 KB |
90_small_teuchi_01.txt | AC | 24 ms | 880 KB |
90_small_teuchi_02.txt | WA | 24 ms | 928 KB |