Submission #994451

#TimeUsernameProblemLanguageResultExecution timeMemory
994451daffuwuBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
332 ms18104 KiB
#include <bits/stdc++.h> using namespace std; #define fr first #define sc second mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); long long ans; char a[3069][3069]; int cnt[3069][2], h, w; //{idx, row/col} int main() { int i, j; scanf("%d%d", &h, &w); for (i=1; i<=h; i++) { for (j=1; j<=w; j++) scanf(" %c", &a[i][j]); } for (i=h; i>=1; i--) { for (j=w; j>=1; j--) { if (a[i][j] == 'J') ans += 1ll*cnt[i][0]*cnt[j][1]; else if (a[i][j] == 'O') cnt[i][0]++; else cnt[j][1]++; } } printf("%lld\n", ans); }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d%d", &h, &w);
      |     ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:17:35: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         for (j=1; j<=w; j++) scanf(" %c", &a[i][j]);
      |                              ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...