Submission #127605

#TimeUsernameProblemLanguageResultExecution timeMemory
127605IOrtroiiiBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
332 ms88904 KiB
#include <bits/stdc++.h> using namespace std; const int N = 3030; char a[N][N]; int row[N][N]; int col[N][N]; int main() { int n, m; scanf("%d %d", &n, &m); for (int i = 1; i <= n; ++i) { scanf("%s", a[i] + 1); } for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { if (a[i][j] == 'O') { ++row[i][j]; } else if (a[i][j] == 'I') { ++col[i][j]; } } } for (int i = 1; i <= n; ++i) { for (int j = m; j > 0; --j) { row[i][j] += row[i][j + 1]; } } for (int j = 1; j <= m; ++j) { for (int i = n; i > 0; --i) { col[i][j] += col[i + 1][j]; } } long long ans = 0; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { if (a[i][j] == 'J') { ans += row[i][j] * col[i][j]; } } } printf("%lld\n", ans); }

Compilation message (stderr)

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