Submission #127442

#TimeUsernameProblemLanguageResultExecution timeMemory
127442arnold518Bitaro the Brave (JOI19_ho_t1)C++14
20 / 100
13 ms8056 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 3000;

int N, M, O[MAXN+10][MAXN+10], I[MAXN+10][MAXN+10], ans;
char S[MAXN+10][MAXN+10];

int main()
{
    int i, j;

    scanf("%d%d", &N, &M);
    for(i=1; i<=N; i++) scanf("%s", S[i]+1);

    for(j=1; j<=N; j++) for(i=M; i>=1; i--) O[j][i]=O[j][i+1]+(S[j][i]=='O');
    for(j=1; j<=M; j++) for(i=N; i>=1; i--) I[i][j]=I[i+1][j]+(S[i][j]=='I');

    for(i=1; i<=N; i++) for(j=1; j<=M; j++)
    {
        if(S[i][j]=='J') ans+=O[i][j]*I[i][j];
    }
    printf("%d", ans);
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:17: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:18:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(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...