Submission #218074

#TimeUsernameProblemLanguageResultExecution timeMemory
218074KoalaMuchBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
125 ms44408 KiB
#include<bits/stdc++.h>
using namespace std;
const int N = 3005;
int dp[N][N];
char s[N];
int main()
{
    int n,m;
    long long ans = 0;
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf(" %s",s+1);
        int O = 0;
        for(int j=m;j>=1;j--)
        {
            dp[i][j] = dp[i-1][j];
            if(s[j]=='J')   dp[i][j]+=O;
            else if(s[j]=='O')  ++O;
            else            ans+=dp[i-1][j];
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Compilation message (stderr)

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