Submission #434972

# Submission time Handle Problem Language Result Execution time Memory
434972 2021-06-22T16:38:38 Z ak2006 Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
3 ms 460 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
const ll mod = 1e9 + 7,inf = 1e18;
#define pb push_back
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
void setIO()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}
int main()
{
    setIO();
    int n,m;
    cin>>n>>m;
    vvc g(n,vc(m));
    vvi je(n,vi(m)),o(n,vi(m));
    for (int i = 0;i<n;i++)for (int j = 0;j<m;j++){cin>>g[i][j];
        je[i][j] = (g[i][j] == 'O');
        o[i][j] = (g[i][j] == 'I');
    }
    for (int i = n - 1;i>=0;i--)
        for (int j = m - 1;j>=0;j--)
            je[i][j] += (j != m - 1 ? je[i][j + 1] : 0),
            o[i][j] += (i != n - 1 ? o[i + 1][j] : 0);
    ll ans = 0;
    for (int i = 0;i<n;i++)for (int j = 0;j<m;j++)
        if (g[i][j] == 'J'){
            ans += 1ll * je[i][j] * 1ll * o[i][j];
        }
    cout<<ans;
    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'void setIO()':
joi2019_ho_t1.cpp:20:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     freopen("input.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:21:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     freopen("output.txt","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -