Submission #197453

#TimeUsernameProblemLanguageResultExecution timeMemory
197453quocnguyen1012Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
218 ms18004 KiB
#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;

const int base = 131;
const int maxn = 3e3 + 5;

int N, M;
char type[maxn][maxn];
int col[maxn];

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  if (fopen("A.INP", "r")){
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  }
  cin >> N >> M;
  for (int i = 1; i <= N; ++i){
    for (int j = 1; j <= M; ++j){
      cin >> type[i][j];
    }
  }
  ll res = 0;
  for (int i = N; i >= 1; --i){
    int have = 0;
    for (int j = M; j >= 1; --j){
      if (type[i][j] == 'O'){
        ++have;
      }
      else if (type[i][j] == 'I'){
        ++col[j];
      }
      else res += 1ll * have * col[j];
    }
  }
  cout << res << '\n';
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:22:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("A.INP", "r", stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:23:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("A.OUT", "w", stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...