제출 #418219

#제출 시각아이디문제언어결과실행 시간메모리
418219tgehrBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
157 ms151328 KiB
// -*- compile-command: "g++ -g -Wno-return-type -Wall -Wextra -DLOCAL -std=c++17 -D_GLIBCXX_DEBUG ho_t1.cpp -oho_t1 && ./ho_t1 " -*-
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
#define int LL
#define vc vector
#define pb push_back
#define pr pair
#define fi first
#define se second
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define f(i,n) for(int i=0;i<(n);i++)
#define fr(i,n) for(int i=(n);i--;)
#define fv(i,v) f(i,sz(v))

main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int h,w;
	cin>>h>>w;
	vc<string> s(h);
	f(i,h) cin>>s[i];
	vc<vc<int>> ning(h,vc<int>(w));
	vc<vc<int>> norb(h,vc<int>(w));
	fr(i,h) fr(j,w){
		ning[i][j]+=(s[i][j]=='I')+(i+1<h?ning[i+1][j]:0);
		norb[i][j]+=(s[i][j]=='O')+(j+1<w?norb[i][j+1]:0);
	}
	int r=0;
	f(i,h) f(j,w){
		if(s[i][j]=='J') r+=ning[i][j]*norb[i][j];
	}
	cout<<r<<'\n';
}

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

joi2019_ho_t1.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...