제출 #151093

#제출 시각아이디문제언어결과실행 시간메모리
151093karmaBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
102 ms18168 KiB
#include <bits/stdc++.h>
#define ll      long long
#define pb      emplace_back
#define mp      make_pair
#define fi      first
#define se      second

using namespace std;

const int N = int(3e3) + 2;
const int mod = int(1e9) + 7;

string s[N];
ll res = 0;
int n, m, c[N], cur;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if(fopen("test.inp", "r")) {
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    }
    cin >> n >> m;
    for(int i = 1; i <= n; ++i) cin >> s[i], s[i] = ' ' + s[i];
    for(int i = n; i >= 1; --i) {
        cur = 0;
        for(int j = 1; j <= m; ++j) {
            if(s[i][j] == 'J') cur += c[j];
            else if(s[i][j] == 'I') ++c[j];
            else if(s[i][j] == 'O') res += cur;
        }
    }
    cout << res;
}

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

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