Submission #2548860
Source Code Expand
#include <bits/stdc++.h> using namespace std; int su[1001][1001]; int dp[1001][1001]; int main(){ int n; scanf("%d",&n); for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ scanf("%d",&su[i][j]); } } for(int i=1;i<n;i++){ for(int j=1;j<=i;j++){ dp[i-1][j] = max(dp[i-1][j], dp[i-1][j-1]); } int sum = 0; for(int j=i;j>=0;j--){ sum += su[i][j]; dp[i][j] = dp[i-1][j] + sum; } } for(int j=1;j<=n;j++){ dp[n-1][j] = max(dp[n-1][j], dp[n-1][j-1]); } printf("%d\n", dp[n-1][n]*2); }
Submission Info
Submission Time | |
---|---|
Task | L - 猫 |
User | jihoon |
Language | C++14 (GCC 5.4.1) |
Score | 5 |
Code Size | 647 Byte |
Status | AC |
Exec Time | 92 ms |
Memory | 8064 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:8:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:11:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&su[i][j]); ^
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 5 / 5 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 03, 04, 05, 06, 07, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 92 ms | 8064 KB |
01 | AC | 90 ms | 8064 KB |
02 | AC | 90 ms | 8064 KB |
03 | AC | 90 ms | 8064 KB |
04 | AC | 90 ms | 8064 KB |
05 | AC | 90 ms | 8064 KB |
06 | AC | 3 ms | 4736 KB |
07 | AC | 24 ms | 6272 KB |
90 | AC | 2 ms | 2304 KB |
91 | AC | 2 ms | 2304 KB |