Submission #49497

#TimeUsernameProblemLanguageResultExecution timeMemory
49497leejseo조개 줍기 (KOI17_shell)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int N, A[1501][1501], DP[1501][1501]; void init(){ scanf("%d", &N); for (int i=0; i<N; i++){ for (int j=0; j<N; j++){ scanf("%d", &A[i][j]); } } } long long query(bool tf){ if (tf){ char a, int i, int j; scanf("%c%d%d", &a, &i, &j); A[i][j] += (a == 'U'? 1 : -1); } lont long s; for (int i=0; i<N; i++){ for (int j=0; j<N; j++){ DP[i][j] = A[i][j] + (i == 0? (j == 0? 0 : DP[i][j-1]) : (j == 0? DP[i-1][j] : max(DP[i-1][j], DP[i][j-1]))); s += DP[i][j] } } return s; } int main(void){ init(); printf("%lld\n", query(false)); for (int i=0; i<N; i++) printf("%lld\n", query(true)); }

Compilation message (stderr)

shell.cpp: In function 'long long int query(bool)':
shell.cpp:17:11: error: expected unqualified-id before 'int'
   char a, int i, int j;
           ^~~
shell.cpp:18:24: error: 'i' was not declared in this scope
   scanf("%c%d%d", &a, &i, &j);
                        ^
shell.cpp:18:28: error: 'j' was not declared in this scope
   scanf("%c%d%d", &a, &i, &j);
                            ^
shell.cpp:21:2: error: 'lont' was not declared in this scope
  lont long s;
  ^~~~
shell.cpp:21:2: note: suggested alternative: 'long'
  lont long s;
  ^~~~
  long
shell.cpp:25:4: error: 's' was not declared in this scope
    s += DP[i][j]
    ^
shell.cpp:28:9: error: 's' was not declared in this scope
  return s;
         ^
shell.cpp: In function 'void init()':
shell.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
shell.cpp:10:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &A[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~