Submission #403395

#TimeUsernameProblemLanguageResultExecution timeMemory
403395shenxy조개 줍기 (KOI17_shell)C++11
12 / 100
246 ms17792 KiB
#include <cstdio> #include <algorithm> using namespace std; int main() { int N; scanf("%d", &N); int A[N][N], S[N][N]; for (int i = 0; i < N; ++i) { for (int j = 0; j < N; ++j) scanf("%d", &A[i][j]); } S[0][0] = A[0][0]; for (int i = 1; i < N; ++i) S[i][0] = S[i - 1][0] + A[i][0], S[0][i] = S[0][i - 1] + A[0][i]; for (int i = 1; i < N; ++i) { for (int j = 1; j < N; ++j) S[i][j] = max(S[i - 1][j], S[i][j - 1]) + A[i][j]; } if (N <= 100) { int r, c, ans = 0; char op; for (int i = 0; i < N; ++i) { for (int j = 0; j < N; ++j) ans += S[i][j]; } printf("%d\n", ans); for (int i = 0; i < N; ++i) { scanf(" %c %d %d", &op, &r, &c); if (op == 'U') ++A[r - 1][c - 1]; else --A[r - 1][c - 1]; S[0][0] = A[0][0]; ans = 0; for (int i = 1; i < N; ++i) S[i][0] = S[i - 1][0] + A[i][0], S[0][i] = S[0][i - 1] + A[0][i]; for (int i = 1; i < N; ++i) { for (int j = 1; j < N; ++j) S[i][j] = max(S[i - 1][j], S[i][j - 1]) + A[i][j]; } for (int i = 0; i < N; ++i) { for (int j = 0; j < N; ++j) ans += S[i][j]; } printf("%d\n", ans); } } return 0; }

Compilation message (stderr)

shell.cpp: In function 'int main()':
shell.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  scanf("%d", &N);
      |  ~~~~~^~~~~~~~~~
shell.cpp:9:36: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   for (int j = 0; j < N; ++j) scanf("%d", &A[i][j]);
      |                               ~~~~~^~~~~~~~~~~~~~~~
shell.cpp:24:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |    scanf(" %c %d %d", &op, &r, &c);
      |    ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...