Submission #1003012

# Submission time Handle Problem Language Result Execution time Memory
1003012 2024-06-20T00:54:07 Z tamir1 Bitaro the Brave (JOI19_ho_t1) C++17
Compilation error
0 ms 0 KB
#include <iostream>#include <cstring> using namespace std; const int N = 3030;int O[N][N];int I[N][N];string s[N];int n, m;  void input(){    cin >> n >> m;    for (int i = 0; i < n; ++i){        cin >> s[i];    }    } void preprocess(){    for (int i = 0; i < n; ++i){        O[i][m] = 0;        for (int j = m - 1; j >= 0; --j){            O[i][j] = O[i][j + 1];            if (s[i][j] == 'O'){                ++O[i][j];            }        }    }    for (int j = 0; j < m; ++j){        I[n][j] = 0;        for (int i = n - 1; i >= 0; --i){            I[i][j] = I[i + 1][j];            if (s[i][j] == 'I'){                ++I[i][j];            }        }    }} int solve(){    long long ans = 0;    for (int i = 0; i < n; ++i){        for (int j = 0; j < m; ++j){            if (s[i][j] == 'J'){                ans += O[i][j] * I[i][j];            }        }    }    return ans;} int main(){    input();    preprocess();    cout << solve();}

Compilation message

joi2019_ho_t1.cpp:1:20: warning: extra tokens at end of #include directive
    1 | #include <iostream>#include <cstring> using namespace std; const int N = 3030;int O[N][N];int I[N][N];string s[N];int n, m;  void input(){    cin >> n >> m;    for (int i = 0; i < n; ++i){        cin >> s[i];    }    } void preprocess(){    for (int i = 0; i < n; ++i){        O[i][m] = 0;        for (int j = m - 1; j >= 0; --j){            O[i][j] = O[i][j + 1];            if (s[i][j] == 'O'){                ++O[i][j];            }        }    }    for (int j = 0; j < m; ++j){        I[n][j] = 0;        for (int i = n - 1; i >= 0; --i){            I[i][j] = I[i + 1][j];            if (s[i][j] == 'I'){                ++I[i][j];            }        }    }} int solve(){    long long ans = 0;    for (int i = 0; i < n; ++i){        for (int j = 0; j < m; ++j){            if (s[i][j] == 'J'){                ans += O[i][j] * I[i][j];            }        }    }    return ans;} int main(){    input();    preprocess();    cout << solve();}
      |                    ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status