제출 #308245

#제출 시각아이디문제언어결과실행 시간메모리
308245Bill_00Bitaro the Brave (JOI19_ho_t1)C++14
50 / 100
1085 ms179908 KiB
#include <bits/stdc++.h>
#define pp push
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
using namespace std;
char a[3005][3005];
ll dpi[3005][3005];
ll dpo[3005][3005];
vector<pair<int,int> >J;
int main(){
	int h,w;
	cin >> h >> w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin >> a[i][j];
			if(a[i][j]=='J'){
				J.pb(mp(i,j));
			}
		}
	}
	for(int i=1;i<=w;i++){
		for(int j=h;j>=1;j--){
			if(a[j][i]=='I'){
				dpi[j][i]=dpi[j+1][i]+1;
			}
			else dpi[j][i]=dpi[j+1][i];
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=w;j>=1;j--){
			if(a[i][j]=='O'){
				dpo[i][j]=dpo[i][j+1]+1;
			}
			else dpo[i][j]=dpo[i][j+1];
		}
	}
	ll ans=0;
	for(int i=0;i<J.size();i++){
		int x=J[i].ff;
		int y=J[i].ss;
		ans+=(dpo[x][y]*dpi[x][y]);
	}
	cout << ans;
}

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:41:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  for(int i=0;i<J.size();i++){
      |              ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...