Submission #197453

# Submission time Handle Problem Language Result Execution time Memory
197453 2020-01-21T10:48:43 Z quocnguyen1012 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
218 ms 18004 KB
#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

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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 632 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 3 ms 632 KB Output is correct
10 Correct 3 ms 632 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Correct 2 ms 632 KB Output is correct
13 Correct 3 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 632 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 3 ms 632 KB Output is correct
10 Correct 3 ms 632 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Correct 2 ms 632 KB Output is correct
13 Correct 3 ms 632 KB Output is correct
14 Correct 7 ms 2040 KB Output is correct
15 Correct 3 ms 1528 KB Output is correct
16 Correct 5 ms 1272 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 9 ms 2040 KB Output is correct
19 Correct 7 ms 2012 KB Output is correct
20 Correct 7 ms 2064 KB Output is correct
21 Correct 9 ms 2040 KB Output is correct
22 Correct 7 ms 2040 KB Output is correct
23 Correct 8 ms 2056 KB Output is correct
24 Correct 9 ms 2040 KB Output is correct
25 Correct 7 ms 2040 KB Output is correct
26 Correct 7 ms 2040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 632 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 3 ms 632 KB Output is correct
10 Correct 3 ms 632 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Correct 2 ms 632 KB Output is correct
13 Correct 3 ms 632 KB Output is correct
14 Correct 7 ms 2040 KB Output is correct
15 Correct 3 ms 1528 KB Output is correct
16 Correct 5 ms 1272 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 9 ms 2040 KB Output is correct
19 Correct 7 ms 2012 KB Output is correct
20 Correct 7 ms 2064 KB Output is correct
21 Correct 9 ms 2040 KB Output is correct
22 Correct 7 ms 2040 KB Output is correct
23 Correct 8 ms 2056 KB Output is correct
24 Correct 9 ms 2040 KB Output is correct
25 Correct 7 ms 2040 KB Output is correct
26 Correct 7 ms 2040 KB Output is correct
27 Correct 218 ms 17460 KB Output is correct
28 Correct 8 ms 7132 KB Output is correct
29 Correct 13 ms 1784 KB Output is correct
30 Correct 3 ms 504 KB Output is correct
31 Correct 146 ms 13900 KB Output is correct
32 Correct 154 ms 17928 KB Output is correct
33 Correct 147 ms 17912 KB Output is correct
34 Correct 171 ms 15988 KB Output is correct
35 Correct 175 ms 17900 KB Output is correct
36 Correct 149 ms 17936 KB Output is correct
37 Correct 210 ms 18004 KB Output is correct
38 Correct 104 ms 13688 KB Output is correct
39 Correct 104 ms 13688 KB Output is correct