Submission #963367

# Submission time Handle Problem Language Result Execution time Memory
963367 2024-04-14T21:57:04 Z leo_2727 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
208 ms 88796 KB
#include <algorithm>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <cmath>
#include <queue>
#include <set>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#define F first
#define S second
#define PB push_back
using namespace std;
const long long MOD=1e9+7, INF=1e18;
const int INFI=1e9;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<pair<int, ii>> viii;
typedef vector<vii> vvii;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h, w;   cin>>h>>w;
    vector<vector<char>> grid(h+1, vector<char>(w+1));
    vvi prefRow(h+1, vi(w+1, 0)), prefCol(h+1, vi(w+1, 0));
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)
            cin>>grid[i][j];
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++){
            prefRow[i][j]=prefRow[i][j-1];
            prefCol[i][j]=prefCol[i-1][j];
            if(grid[i][j]=='O') prefRow[i][j]++;
            if(grid[i][j]=='I') prefCol[i][j]++;
        }
    ll ans=0;
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)
            if(grid[i][j]=='J')
                ans+=(prefRow[i][w]-prefRow[i][j])*(prefCol[h][j]-prefCol[i][j]);
    cout<<ans<<"\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 452 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 452 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 5 ms 2396 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 1628 KB Output is correct
17 Correct 1 ms 356 KB Output is correct
18 Correct 6 ms 2908 KB Output is correct
19 Correct 4 ms 2648 KB Output is correct
20 Correct 4 ms 2916 KB Output is correct
21 Correct 6 ms 2912 KB Output is correct
22 Correct 5 ms 2652 KB Output is correct
23 Correct 4 ms 2920 KB Output is correct
24 Correct 7 ms 2960 KB Output is correct
25 Correct 4 ms 2660 KB Output is correct
26 Correct 4 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 452 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 5 ms 2396 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 1628 KB Output is correct
17 Correct 1 ms 356 KB Output is correct
18 Correct 6 ms 2908 KB Output is correct
19 Correct 4 ms 2648 KB Output is correct
20 Correct 4 ms 2916 KB Output is correct
21 Correct 6 ms 2912 KB Output is correct
22 Correct 5 ms 2652 KB Output is correct
23 Correct 4 ms 2920 KB Output is correct
24 Correct 7 ms 2960 KB Output is correct
25 Correct 4 ms 2660 KB Output is correct
26 Correct 4 ms 2908 KB Output is correct
27 Correct 191 ms 83944 KB Output is correct
28 Correct 1 ms 860 KB Output is correct
29 Correct 10 ms 6748 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 139 ms 61776 KB Output is correct
32 Correct 143 ms 88276 KB Output is correct
33 Correct 138 ms 88404 KB Output is correct
34 Correct 164 ms 71724 KB Output is correct
35 Correct 158 ms 88232 KB Output is correct
36 Correct 155 ms 88400 KB Output is correct
37 Correct 208 ms 88796 KB Output is correct
38 Correct 114 ms 61360 KB Output is correct
39 Correct 98 ms 61456 KB Output is correct