답안 #124062

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
124062 2019-07-02T12:48:00 Z rajarshi_basu Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
937 ms 159316 KB
#include <iostream>
#include <vector>
#include <set>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <fstream>
#include <complex>
#include <stack>
#include <set>

#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define vv vector
#define ff first
#define ss second
#define pll pair<ll,ll>
#define cd complex<double> 
#define ld long double
#define pld pair<ld,ld>
#define iii pair<ii,int>

using namespace std;

const int MAXN = 3000;
const int MAXK = 100+10;

string s[MAXN];
ll tolow[MAXN][MAXN];
ll tori[MAXN][MAXN];

int main(){
	int n,m;
	cin >> n >> m;
	FOR(i,n){
		cin >> s[i];
	}
	FOR(j,m){
		tolow[n-1][j] = s[n-1][j] == 'I';
		for(int i = n-2;i>=0;i--){
			tolow[i][j] = tolow[i+1][j] + (s[i][j] == 'I');
		}
	}
	FOR(i,n){
		tori[i][m-1] = s[i][m-1] == 'O';
		for(int j = m-2;j>=0;j--){
			tori[i][j] = tori[i][j+1] + (s[i][j] == 'O');
		}
	}
	ll ans = 0;
	FOR(i,n){
		FOR(j,m){
			if(s[i][j] == 'J')ans += tori[i][j]*tolow[i][j];
		}
	}
	cout << ans << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1400 KB Output is correct
6 Correct 3 ms 1400 KB Output is correct
7 Correct 3 ms 1272 KB Output is correct
8 Correct 3 ms 1400 KB Output is correct
9 Correct 3 ms 1400 KB Output is correct
10 Correct 3 ms 1272 KB Output is correct
11 Correct 4 ms 1400 KB Output is correct
12 Correct 3 ms 1400 KB Output is correct
13 Correct 3 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1400 KB Output is correct
6 Correct 3 ms 1400 KB Output is correct
7 Correct 3 ms 1272 KB Output is correct
8 Correct 3 ms 1400 KB Output is correct
9 Correct 3 ms 1400 KB Output is correct
10 Correct 3 ms 1272 KB Output is correct
11 Correct 4 ms 1400 KB Output is correct
12 Correct 3 ms 1400 KB Output is correct
13 Correct 3 ms 1272 KB Output is correct
14 Correct 21 ms 7928 KB Output is correct
15 Correct 5 ms 3832 KB Output is correct
16 Correct 14 ms 4856 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 26 ms 9080 KB Output is correct
19 Correct 24 ms 8696 KB Output is correct
20 Correct 24 ms 8824 KB Output is correct
21 Correct 25 ms 9080 KB Output is correct
22 Correct 24 ms 8700 KB Output is correct
23 Correct 24 ms 8952 KB Output is correct
24 Correct 26 ms 9080 KB Output is correct
25 Correct 24 ms 8696 KB Output is correct
26 Correct 24 ms 8824 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1400 KB Output is correct
6 Correct 3 ms 1400 KB Output is correct
7 Correct 3 ms 1272 KB Output is correct
8 Correct 3 ms 1400 KB Output is correct
9 Correct 3 ms 1400 KB Output is correct
10 Correct 3 ms 1272 KB Output is correct
11 Correct 4 ms 1400 KB Output is correct
12 Correct 3 ms 1400 KB Output is correct
13 Correct 3 ms 1272 KB Output is correct
14 Correct 21 ms 7928 KB Output is correct
15 Correct 5 ms 3832 KB Output is correct
16 Correct 14 ms 4856 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 26 ms 9080 KB Output is correct
19 Correct 24 ms 8696 KB Output is correct
20 Correct 24 ms 8824 KB Output is correct
21 Correct 25 ms 9080 KB Output is correct
22 Correct 24 ms 8700 KB Output is correct
23 Correct 24 ms 8952 KB Output is correct
24 Correct 26 ms 9080 KB Output is correct
25 Correct 24 ms 8696 KB Output is correct
26 Correct 24 ms 8824 KB Output is correct
27 Correct 904 ms 158840 KB Output is correct
28 Correct 21 ms 19452 KB Output is correct
29 Correct 56 ms 14200 KB Output is correct
30 Correct 4 ms 888 KB Output is correct
31 Correct 666 ms 133536 KB Output is correct
32 Correct 912 ms 159260 KB Output is correct
33 Correct 907 ms 158712 KB Output is correct
34 Correct 776 ms 154104 KB Output is correct
35 Correct 925 ms 159316 KB Output is correct
36 Correct 907 ms 158840 KB Output is correct
37 Correct 937 ms 159228 KB Output is correct
38 Correct 658 ms 133188 KB Output is correct
39 Correct 641 ms 132832 KB Output is correct