Submission #934380

#TimeUsernameProblemLanguageResultExecution timeMemory
934380SmuggingSpunBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
197 ms18044 KiB
#include<bits/stdc++.h> #define taskname "ho-t1" using namespace std; typedef long long ll; const int lim = 3005; int r[lim]; char a[lim][lim]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } int n, m; cin >> n >> m; memset(r, 0, sizeof(r)); for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cin >> a[i][j]; if(a[i][j] == 'O'){ r[i]++; } } } ll ans = 0; for(int j = 1; j <= m; j++){ int cnt_i = 0; for(int i = 1; i <= n; i++){ if(a[i][j] == 'I'){ cnt_i++; } } for(int i = 1; i <= n; i++){ if(a[i][j] == 'O'){ r[i]--; } else if(a[i][j] == 'I'){ cnt_i--; } else{ ans += r[i] * cnt_i; } } } cout << ans; }

Compilation message (stderr)

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