Submission #171280

#TimeUsernameProblemLanguageResultExecution timeMemory
171280dennisstarBitaro the Brave (JOI19_ho_t1)C++11
100 / 100
242 ms88712 KiB
#include <bits/stdc++.h> #define fi first #define se second #define ryan bear #define all(V) ((V).begin()), ((V).end()) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; typedef vector<int> vim; typedef vector<ll> vlm; int H, W; char ar[3010][3010]; int c1[3010][3010], c2[3010][3010]; ll ans; int main() { scanf("%d %d", &H, &W); for (int i=0; i<H; i++) { scanf("%s", ar[i]); for (int j=W-1; j>=0; j--) { c1[i][j]=c1[i][j+1]; if (ar[i][j+1]=='O') c1[i][j]++; } } for (int i=H-1; i>=0; i--) { for (int j=0; j<W; j++) { c2[i][j]=c2[i+1][j]; if (ar[i+1][j]=='I') c2[i][j]++; if (ar[i][j]=='J') ans+=(ll)c1[i][j]*c2[i][j]; } } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &H, &W);
  ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", ar[i]);
   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...