Submission #108720

# Submission time Handle Problem Language Result Execution time Memory
108720 2019-05-01T07:36:09 Z tictaccat Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
37 ms 35960 KB
//testing

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAX = 3000 + 10;

int H,W;
vector<vector<int>> grid(MAX,vector<int>(MAX));
int ups1[MAX][MAX], ups2[MAX][MAX], lefts1[MAX][MAX], lefts2[MAX][MAX];

int main() {
    
    cin >> H >> W;

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            char c; cin >> c;
            if (c == 'J') grid[i][j] = 0;
            else if (c == 'O') grid[i][j] = 1;
            else grid[i][j] = 2;
         }
    }

    ll c = 0;

    for (int i = H-1; i >= 0; i--) {
        for (int j = W-1; j >= 0; j--) {
            ups1[i][j] = move(ups1[i+1][j]);
            ups2[i][j] = move(ups2[i+1][j]);
            lefts1[i][j] = move(lefts1[i][j+1]);
            lefts2[i][j] = move(lefts2[i][j+1]);
            ll ways = 0;
            if (grid[i][j] == 0) {
                ways += (ll)ups1[i][j]*lefts2[i][j];
                ways += (ll)ups2[i][j]*lefts1[i][j];
            }
            if (grid[i][j] == 1) {
                ups1[i][j]++;
                lefts1[i][j]++;
            }
             if (grid[i][j] == 2) {
                ups2[i][j]++;
                lefts2[i][j]++;
            }           
            c += ways;
        }
    }

    cout << c << "\n";


}
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 35960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 35960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 35960 KB Output isn't correct
2 Halted 0 ms 0 KB -