Submission #893508

# Submission time Handle Problem Language Result Execution time Memory
893508 2023-12-27T06:01:27 Z Malix Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
384 ms 18396 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair

const int m=1e9+7;

int main(){
 //ios::sync_with_stdio(0);
// cin.tie(0);
//freopen("test_input.txt", "r", stdin);
//freopen("test_output.txt", "w", stdout);
    int a,b;cin>>a>>b;
    vector<vector<char>> grid(a,vector<char>(b));
    REP(i,0,a)REP(j,0,b)cin>>grid[i][j];
    vi ic(b,0),oc(a,0);
    REP(i,0,a)REP(j,0,b){
        if(grid[i][j]=='I')ic[j]++;
        else if(grid[i][j]=='O')oc[i]++;
    }
    ll ans=0;
    REP(i,0,a)REP(j,0,b){
         if(grid[i][j]=='I')ic[j]--;
         else if(grid[i][j]=='O')oc[i]--;
         else ans+=(ll)oc[i]*ic[j];
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 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 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 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 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 10 ms 616 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 5 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 11 ms 696 KB Output is correct
19 Correct 8 ms 692 KB Output is correct
20 Correct 9 ms 688 KB Output is correct
21 Correct 13 ms 860 KB Output is correct
22 Correct 9 ms 860 KB Output is correct
23 Correct 9 ms 860 KB Output is correct
24 Correct 11 ms 860 KB Output is correct
25 Correct 9 ms 924 KB Output is correct
26 Correct 11 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 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 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 10 ms 616 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 5 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 11 ms 696 KB Output is correct
19 Correct 8 ms 692 KB Output is correct
20 Correct 9 ms 688 KB Output is correct
21 Correct 13 ms 860 KB Output is correct
22 Correct 9 ms 860 KB Output is correct
23 Correct 9 ms 860 KB Output is correct
24 Correct 11 ms 860 KB Output is correct
25 Correct 9 ms 924 KB Output is correct
26 Correct 11 ms 860 KB Output is correct
27 Correct 371 ms 17016 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 22 ms 1624 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 276 ms 13008 KB Output is correct
32 Correct 314 ms 17976 KB Output is correct
33 Correct 307 ms 17984 KB Output is correct
34 Correct 313 ms 14676 KB Output is correct
35 Correct 314 ms 18088 KB Output is correct
36 Correct 301 ms 17860 KB Output is correct
37 Correct 384 ms 18396 KB Output is correct
38 Correct 217 ms 12588 KB Output is correct
39 Correct 212 ms 12628 KB Output is correct