답안 #996956

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996956 2024-06-11T14:03:32 Z coolboy19521 Bitaro the Brave (JOI19_ho_t1) C++17
컴파일 오류
0 ms 0 KB
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

#define int long long

using namespace std;

const int sz = 3e3 + 9;

vector <int> os[sz], is[sz];
char a[sz][sz];

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int h, w;
    cin >> h >> w;

    int r = 0;

    for (int i = 1; i <= h; i ++) {
        for (int j = 1; j <= w; j ++) {
            cin >> a[i][j];

            if ('O' == a[i][j]) {
                os[i].push_back(j);
            } else if ('I' == a[i][j]) {
                is[j].push_back(i);
            }
        }
    }

    for (int i = 1; i <= h; i ++) {
        for (int j = 1; j <= w; j ++) {
            if ('J' == a[i][j]) {
                if (!os.count(i) || !is.count(j)) continue;

                int oc = os[i].end() - upper_bound(begin(os[i]), end(os[i]), j);
                int ic = is[j].end() - upper_bound(begin(is[j]), end(is[j]), i);
                r += oc * ic;
            }
        }
    }

    cout << r << '\n';
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:36:25: error: request for member 'count' in 'os', which is of non-class type 'std::vector<long long int> [3009]'
   36 |                 if (!os.count(i) || !is.count(j)) continue;
      |                         ^~~~~
joi2019_ho_t1.cpp:36:41: error: request for member 'count' in 'is', which is of non-class type 'std::vector<long long int> [3009]'
   36 |                 if (!os.count(i) || !is.count(j)) continue;
      |                                         ^~~~~