답안 #157704

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
157704 2019-10-12T18:12:15 Z InfiniteJest Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
2 ms 376 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 pref[5000][5000];
int prefb[5000][5000];
int sump[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'){
        sump[y]++;
        f[y]++;
      }
      else{
        tot+=f[y]*fb[y];
        f[y]=0;
      }
      if(tab[i][y]!='J'&&i==h-1){
        tot+=f[i]*fb[i];
      }
      prefb[i][y]=sum;
      pref[i][y]=sump[y];
    }
    sumf=sum;
  }
  
  cout<<tot;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -