Submission #403360

#TimeUsernameProblemLanguageResultExecution timeMemory
403360maomao90조개 줍기 (KOI17_shell)C++14
12 / 100
2077 ms26728 KiB
#include <bits/stdc++.h> using namespace std; #define mnto(x, y) x = min(x, (__typeof__(x)) y) #define mxto(x, y) x = max(x, (__typeof__(x)) y) #define REP(i, s, e) for (int i = s; i < e; i++) #define RREP(i, s, e) for (int i = s; i >= e; i--) typedef long long ll; typedef long double ld; #define MP make_pair #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define MT make_tuple typedef tuple<int, int, int> iii; #define ALL(_a) _a.begin(), _a.end() #define pb emplace_back typedef vector<int> vi; typedef vector<ii> vii; #define INF 1000000005 #define LINF 1000000000000000005 #define MOD 1000000007 #define MAXN 1505 int n; int a[MAXN][MAXN]; ll s[MAXN][MAXN]; ll dp() { memset(s, 0, sizeof s); ll res = 0; REP (i, 1, n + 1) { REP (j, 1, n + 1) { s[i][j] = a[i][j] + max(s[i - 1][j], s[i][j - 1]); res += s[i][j]; } } return res; } int main() { scanf("%d", &n); REP (i, 1, n + 1) { REP (j, 1, n + 1) { scanf("%d", &a[i][j]); } } printf("%lld\n", dp()); REP (i, 0, n) { char o; int r, c; scanf(" %c%d%d", &o, &r, &c); if (o == 'U') { a[r][c]++; } else { a[r][c]--; } printf("%lld\n", dp()); } return 0; } /* 3 3 2 7 4 2 6 5 3 8 U 1 2 D 3 2 U 1 2 */

Compilation message (stderr)

shell.cpp: In function 'int main()':
shell.cpp:44:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
shell.cpp:47:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |    scanf("%d", &a[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~
shell.cpp:52:26: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |   char o; int r, c; scanf(" %c%d%d", &o, &r, &c);
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...