Submission #374756

#TimeUsernameProblemLanguageResultExecution timeMemory
374756daniel920712Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
180 ms18156 KiB
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <vector> #include <algorithm> using namespace std; long long con1[5][3005]={0}; long long con2[5][3005]={0}; char all[3005][3005]; int main() { long long N,M,ans=0,i,j; scanf("%lld %lld",&N,&M); for(i=0;i<N;i++) { scanf("%s",all[i]); for(j=0;j<M;j++) { if(all[i][j]=='J') { con1[0][i]++; con2[0][j]++; } else if(all[i][j]=='O') { con1[1][i]++; con2[1][j]++; } else { con1[2][i]++; con2[2][j]++; } } } for(i=0;i<N;i++) { for(j=0;j<M;j++) { if(all[i][j]=='J') ans+=(con1[1][i])*(con2[2][j]); if(all[i][j]=='J') { con1[0][i]--; con2[0][j]--; } else if(all[i][j]=='O') { con1[1][i]--; con2[1][j]--; } else { con1[2][i]--; con2[2][j]--; } } } printf("%lld\n",ans); return 0; }

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("%lld %lld",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |         scanf("%s",all[i]);
      |         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...