Submission #157752

# Submission time Handle Problem Language Result Execution time Memory
157752 2019-10-12T19:41:35 Z InfiniteJest Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
1000 ms 70980 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

typedef long long ll;

int h,w;
char tab[5000][5000];
int prefb[5000][5000];
int fb[5000];
int f[5000];
vector<pair<int,int> > v;

int main(){
  cin>>h>>w;
  int sumf;
  ll tot=0;
  for(int i=0;i<h;i++){
    int sum=0;
    for(int y=0;y<w;y++){
      cin>>tab[i][y];
      if(i!=0&&tab[i-1][y]=='J')fb[y]+=sumf-prefb[i-1][y];
      if(tab[i][y]=='O')sum++;
      else if(tab[i][y]=='I'){
        f[y]++;
      }
      else{
        tot+=f[y]*fb[y];
        f[y]=0;
      }
      if(tab[i][y]!='J'&&i==h-1){
        tot+=f[y]*fb[y];
      }
      prefb[i][y]=sum;
    }
    sumf=sum;
  }
  
  cout<<tot;

}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 4 ms 1272 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 3 ms 1144 KB Output is correct
8 Correct 4 ms 1144 KB Output is correct
9 Correct 4 ms 1272 KB Output is correct
10 Correct 3 ms 1144 KB Output is correct
11 Correct 4 ms 1272 KB Output is correct
12 Correct 4 ms 1272 KB Output is correct
13 Correct 3 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 4 ms 1272 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 3 ms 1144 KB Output is correct
8 Correct 4 ms 1144 KB Output is correct
9 Correct 4 ms 1272 KB Output is correct
10 Correct 3 ms 1144 KB Output is correct
11 Correct 4 ms 1272 KB Output is correct
12 Correct 4 ms 1272 KB Output is correct
13 Correct 3 ms 1144 KB Output is correct
14 Correct 28 ms 5624 KB Output is correct
15 Correct 5 ms 3704 KB Output is correct
16 Correct 17 ms 3320 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 34 ms 5752 KB Output is correct
19 Correct 30 ms 5752 KB Output is correct
20 Correct 30 ms 5624 KB Output is correct
21 Correct 34 ms 5824 KB Output is correct
22 Correct 31 ms 5752 KB Output is correct
23 Correct 31 ms 5624 KB Output is correct
24 Correct 34 ms 5752 KB Output is correct
25 Correct 30 ms 5752 KB Output is correct
26 Correct 29 ms 5752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 4 ms 1272 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 3 ms 1144 KB Output is correct
8 Correct 4 ms 1144 KB Output is correct
9 Correct 4 ms 1272 KB Output is correct
10 Correct 3 ms 1144 KB Output is correct
11 Correct 4 ms 1272 KB Output is correct
12 Correct 4 ms 1272 KB Output is correct
13 Correct 3 ms 1144 KB Output is correct
14 Correct 28 ms 5624 KB Output is correct
15 Correct 5 ms 3704 KB Output is correct
16 Correct 17 ms 3320 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 34 ms 5752 KB Output is correct
19 Correct 30 ms 5752 KB Output is correct
20 Correct 30 ms 5624 KB Output is correct
21 Correct 34 ms 5824 KB Output is correct
22 Correct 31 ms 5752 KB Output is correct
23 Correct 31 ms 5624 KB Output is correct
24 Correct 34 ms 5752 KB Output is correct
25 Correct 30 ms 5752 KB Output is correct
26 Correct 29 ms 5752 KB Output is correct
27 Correct 1000 ms 60900 KB Output is correct
28 Correct 19 ms 19068 KB Output is correct
29 Correct 69 ms 5836 KB Output is correct
30 Correct 5 ms 504 KB Output is correct
31 Correct 735 ms 53368 KB Output is correct
32 Correct 948 ms 70876 KB Output is correct
33 Incorrect 913 ms 70980 KB Output isn't correct
34 Halted 0 ms 0 KB -