제출 #404840

#제출 시각아이디문제언어결과실행 시간메모리
404840radaiosm7Bitaro the Brave (JOI19_ho_t1)C++98
100 / 100
274 ms88464 KiB
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
int n, m, i, j;
char c, mat[3005][3005];
long long ans;
vector<pair<int, int> > Jew;
int col[3005][3005];
int row[3005][3005];

int main() {
  scanf("%d%d", &n, &m);

  for (i=0; i < n; ++i) {
    scanf("\n%s", mat[i]);
  }

  for (i=0; i < n; ++i) {
    row[i][m-1] = 0;
    for (j=m-1; j >= 0; --j) {
      row[i][j] = row[i][j+1] + (mat[i][j]=='O');
    }
  }

  for (j=0; j < m; ++j) {
    col[n-1][j] = 0;
    for (i=n-1; i >= 0; --i) {
      col[i][j] = col[i+1][j] + (mat[i][j]=='I');
    }
  }

  ans = 0LL;

  for (i=0; i < n; ++i) {
    for (j=0; j < m; ++j) {
      if (mat[i][j] == 'J') {
        ans += (long long)col[i][j]*row[i][j];
      }
    }
  }

  printf("%lld\n", ans);
  return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d", &n, &m);
      |   ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("\n%s", mat[i]);
      |     ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...