Submission #160484

#TimeUsernameProblemLanguageResultExecution timeMemory
160484kingfran1907Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
168 ms53372 KiB
#include <bits/stdc++.h> using namespace std; typedef long long llint; const int maxn = 3010; int n, m; char niz[maxn][maxn]; int pref[maxn][maxn]; llint cnt[maxn]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) scanf("%s", niz+i); llint sol = 0; for (int i = 0; i < n; i++) { for (int j = m - 1; j >= 0; j--) pref[i][j] = pref[i][j + 1] + (niz[i][j] == 'O'); } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (niz[i][j] == 'J') cnt[j] += pref[i][j]; else if (niz[i][j] == 'I') { sol += cnt[j]; //printf("%d %d -> %d\n", i, j, cnt[j]); } } } printf("%lld\n", sol); return 0; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:15:26: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[3010]' [-Wformat=]
         scanf("%s", niz+i);
                     ~~~~~^
joi2019_ho_t1.cpp:13: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:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s", niz+i);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...