Submission #165140

#TimeUsernameProblemLanguageResultExecution timeMemory
165140AkashiBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
152 ms88504 KiB
#include <bits/stdc++.h>
using namespace std;

int n, m;
char s[3005][3005];
int l[3005][3005], c[3005][3005];
int main()
{
//    freopen("1.in", "r", stdin);

    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n ; ++i) scanf("%s", s[i] + 1);

    long long Sol = 0;
    for(int i = n; i >= 1 ; --i){
        for(int j = m; j >= 1 ; --j){
            c[i][j] = c[i][j + 1] + (s[i][j] == 'O');
            l[i][j] = l[i + 1][j] + (s[i][j] == 'I');

            if(s[i][j] == 'J') Sol = Sol + 1LL * l[i][j] * c[i][j];
        }
    }

    printf("%lld", Sol);

    return 0;
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:11:10: 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:12:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n ; ++i) scanf("%s", s[i] + 1);
                                  ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...