답안 #1027169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027169 2024-07-19T01:32:33 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
#define int long long
#define INF LLONG_MAX
#define pii pair<int, int>
using namespace std;

int32_t main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

     int h, w;
     cin >> h >> w;
     vector<vector<char>> grid(h, vector<char>(w));
     vector<int> rowcnt(h, 0), colcnt(w, 0);
     for (int i = 0; i < h; i++)
     {
          string s;
          cin >> s;
          for (int j = 0; j < w; j++)
          {
               if (s[j] == 'O')
                    rowcnt[i]++;
               else if (s[j] == 'I')
                    colcnt[j]++;
               grid[i][j] = s[j];
          }
     }
     int ans = 0;
     for (int i = 0; i < h; i++)
     {
          for (int j = 0; j < w; j++)
          {
               if (rowcnt[i] == 0)
                    break;
               if (colcnt[j] == 0)
                    continue;
               if (grid[i][j] == 'J')
                    ans += (rowcnt[i] * colcnt[j]);
               else if (grid[i][j] == 'O')
                    rowcnt[i]--;
               else
                    colcnt[j]--;
          }
     }
     cout << ans << endl;

     return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -