답안 #1037861

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037861 2024-07-29T09:21:54 Z mateuszwes Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
203 ms 159312 KB
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define F first
#define S second
#define pb push_back
#define pi pair<int,int>
#define pl pair<ll,ll>
 
using namespace std;
constexpr int debug = 0;
constexpr int N = 3007;

ll ignots[N][N];		//amount of ignots below the given point;
ll orbs[N][N];			//amount of orbs on the right
char tab[N][N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int rows, columns; cin >> rows >> columns;
	ll sc = 0;
	for(int y = 0; y < rows; y++){
		for(int x = 0; x < columns; x++){
			cin >> tab[x][y];
		}
	}
	for(int y = rows-1; y >= 0; y--){
		for(int x = columns-1; x >= 0; x--){
			ignots[x][y] = ignots[x][y+1];
			orbs[x][y] = orbs[x+1][y];
			if(tab[x][y] == 'J') sc += ignots[x][y]*orbs[x][y];
			else if(tab[x][y] == 'O') orbs[x][y]++;
			else ignots[x][y]++;
		}
	}
	cout << sc;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 2 ms 5212 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 1 ms 5212 KB Output is correct
9 Correct 1 ms 4956 KB Output is correct
10 Correct 1 ms 5212 KB Output is correct
11 Correct 1 ms 5208 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 1 ms 5212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 2 ms 5212 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 1 ms 5212 KB Output is correct
9 Correct 1 ms 4956 KB Output is correct
10 Correct 1 ms 5212 KB Output is correct
11 Correct 1 ms 5208 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 1 ms 5212 KB Output is correct
14 Correct 6 ms 14428 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 4 ms 16476 KB Output is correct
17 Correct 2 ms 10072 KB Output is correct
18 Correct 8 ms 17620 KB Output is correct
19 Correct 7 ms 17496 KB Output is correct
20 Correct 6 ms 17656 KB Output is correct
21 Correct 7 ms 17652 KB Output is correct
22 Correct 9 ms 17500 KB Output is correct
23 Correct 6 ms 17672 KB Output is correct
24 Correct 7 ms 17756 KB Output is correct
25 Correct 6 ms 17472 KB Output is correct
26 Correct 6 ms 17756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 2 ms 5212 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 1 ms 5212 KB Output is correct
9 Correct 1 ms 4956 KB Output is correct
10 Correct 1 ms 5212 KB Output is correct
11 Correct 1 ms 5208 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 1 ms 5212 KB Output is correct
14 Correct 6 ms 14428 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 4 ms 16476 KB Output is correct
17 Correct 2 ms 10072 KB Output is correct
18 Correct 8 ms 17620 KB Output is correct
19 Correct 7 ms 17496 KB Output is correct
20 Correct 6 ms 17656 KB Output is correct
21 Correct 7 ms 17652 KB Output is correct
22 Correct 9 ms 17500 KB Output is correct
23 Correct 6 ms 17672 KB Output is correct
24 Correct 7 ms 17756 KB Output is correct
25 Correct 6 ms 17472 KB Output is correct
26 Correct 6 ms 17756 KB Output is correct
27 Correct 196 ms 150864 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 23 ms 82448 KB Output is correct
30 Correct 11 ms 71772 KB Output is correct
31 Correct 145 ms 132984 KB Output is correct
32 Correct 186 ms 158292 KB Output is correct
33 Correct 203 ms 159284 KB Output is correct
34 Correct 179 ms 133968 KB Output is correct
35 Correct 179 ms 158192 KB Output is correct
36 Correct 181 ms 159176 KB Output is correct
37 Correct 197 ms 159312 KB Output is correct
38 Correct 132 ms 131920 KB Output is correct
39 Correct 167 ms 132728 KB Output is correct