Submission #10405622
Source Code Expand
#include <bits/stdc++.h> using namespace std; int n, k, extra; int sol[100010][4]; int main() { cin >> n >> sol[1][1] >> sol[1][2] >> sol[1][3]; for (int i = 2; i <= n; i++) for (int j = 1; j <= 3; j++) { cin >> extra; for (int h = 1; h <= 3; h++) if (j != h) sol[i][j] = max(sol[i][j], sol[i - 1][h] + extra); } cout << max(max(sol[n][1], sol[n][2]), sol[n][3]); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Vacation |
User | CosminMorar |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 496 Byte |
Status | AC |
Exec Time | 111 ms |
Memory | 1792 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 0_00, 0_01, 0_02, 1_00, 1_01, 1_02, 1_03, 1_04, 1_05, 1_06, 1_07, 1_08, 1_09 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00 | AC | 1 ms | 256 KB |
0_01 | AC | 1 ms | 256 KB |
0_02 | AC | 1 ms | 256 KB |
1_00 | AC | 1 ms | 256 KB |
1_01 | AC | 111 ms | 1792 KB |
1_02 | AC | 93 ms | 1792 KB |
1_03 | AC | 93 ms | 1792 KB |
1_04 | AC | 92 ms | 1792 KB |
1_05 | AC | 94 ms | 1792 KB |
1_06 | AC | 93 ms | 1792 KB |
1_07 | AC | 93 ms | 1792 KB |
1_08 | AC | 91 ms | 1792 KB |
1_09 | AC | 93 ms | 1792 KB |