Submission #926880

#TimeUsernameProblemLanguageResultExecution timeMemory
926880haru09Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
150 ms18020 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define task "code" const int ar=3e3+5; const ll mod=1e9+7; int m,n; char a[ar][ar]; int cnt[ar]; ll ans=0; int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); if (fopen(task".inp","r")) { freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } cin>>m>>n; for (int i=1;i<=m;i++) { for (int j=1;j<=n;j++) { cin>>a[i][j]; } } for (int i=m;i>=1;i--) { int sum=0; for (int j=1;j<=n;j++) { if (a[i][j]=='J') sum+=cnt[j]; else if (a[i][j]=='O') { ans+=sum; } } for (int j=1;j<=n;j++) { if (a[i][j]=='I') cnt[j]++; } } cout<<ans; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:20:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         freopen(task".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:21:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         freopen(task".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...