제출 #1291532

#제출 시각아이디문제언어결과실행 시간메모리
1291532anhphantBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
129 ms150448 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll n, m;
char a[3007][3007];
ll pO[3007][3007], pS[3007][3007];

void solve() {
    cin >> n >> m;
    for(int i = 1; i <= n; ++i) {
        for(int  j = 1; j <= m; ++j) {
            cin >> a[i][j];
        }
    }

    ll ans = 0;
    for(int i = n; i >= 1; --i) {
        for(int j = m; j >= 1; --j) {
            pO[i][j] = pO[i][j + 1] + (a[i][j] == 'O');
            pS[i][j] = pS[i + 1][j] + (a[i][j] == 'I');
            ans += (a[i][j] == 'J') * pO[i][j] * pS[i][j];
        }
    }

    cout << ans << '\n';
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0); cerr.tie(0);
    if (fopen("test.inp", "r")) {
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    }

    solve();
}

컴파일 시 표준 에러 (stderr) 메시지

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