Submission #210480

#TimeUsernameProblemLanguageResultExecution timeMemory
210480gratus907Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
268 ms153976 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define all(x) ((x).begin()),((x).end()) #define int ll using pii = pair<int, int>; #define INF 0x7f7f7f7f7f7f7f7f const bool debug = false; char arrange[3030][3030]; int orb[3030][3030]; int ingot[3030][3030]; int h, w; int32_t main() { scanf("%lld %lld",&h, &w); for (int i = 1; i<=h; i++) scanf("%s",arrange[i]+1); for (int i = 1; i<=h; i++) { for (int j = 1; j<=w; j++) { if (arrange[i][j]=='O') orb[i][j]++; else if (arrange[i][j]=='I') ingot[i][j]++; } } for (int i = 1; i<=h; i++) for (int j = w-1; j>=1; j--) orb[i][j] += orb[i][j+1]; for (int i = 1; i<=w; i++) for (int j = h-1; j>=1; j--) ingot[j][i] += ingot[j+1][i]; int ans = 0; for (int i = 1; i<=h; i++) for (int j = 1; j<=w; j++) if (arrange[i][j]=='J') ans += orb[i][j+1]*ingot[i+1][j]; printf("%lld\n",ans); }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int32_t main()':
joi2019_ho_t1.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld",&h, &w);
     ~~~~~^~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",arrange[i]+1);
         ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...