# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1086317 | 2024-09-10T07:08:01 Z | kiethm07 | Bitaro the Brave (JOI19_ho_t1) | C++11 | 213 ms | 88512 KB |
#include <bits/stdc++.h> #define pii pair<int,int> #define iii pair<int,pii> #define fi first #define se second #define vi vector<int> #define all(x) x.begin(),x.end() #define TEXT "a" using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; const int inf = 1e9 + 7; const ld eps = 1e-8; const double pi = acos(-1); const int N = 3005; int n,m; char a[N][N]; int row[N][N], col[N][N]; int main(){ cin.tie(0) -> sync_with_stdio(0); if (fopen(TEXT".inp","r")){ freopen(TEXT".inp","r",stdin); freopen(TEXT".out","w",stdout); } cin >> n >> m; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++) cin >> a[i][j]; } for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ col[i][j] = col[i][j - 1] + (a[i][j] == 'O'); } } for (int j = 1; j <= m; j++){ for (int i = 1; i <= n; i++){ row[i][j] = row[i - 1][j] + (a[i][j] == 'I'); } } ll res = 0; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ if (a[i][j] != 'J') continue; ll x = row[n][j] - row[i][j]; ll y = col[i][m] - col[i][j]; res += x * y; } } cout << res << "\n"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 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 | 1 ms | 1628 KB | Output is correct |
6 | Correct | 1 ms | 1628 KB | Output is correct |
7 | Correct | 1 ms | 1372 KB | Output is correct |
8 | Correct | 1 ms | 1468 KB | Output is correct |
9 | Correct | 1 ms | 1628 KB | Output is correct |
10 | Correct | 1 ms | 1500 KB | Output is correct |
11 | Correct | 1 ms | 1628 KB | Output is correct |
12 | Correct | 1 ms | 1880 KB | Output is correct |
13 | Correct | 1 ms | 1372 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 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 | 1 ms | 1628 KB | Output is correct |
6 | Correct | 1 ms | 1628 KB | Output is correct |
7 | Correct | 1 ms | 1372 KB | Output is correct |
8 | Correct | 1 ms | 1468 KB | Output is correct |
9 | Correct | 1 ms | 1628 KB | Output is correct |
10 | Correct | 1 ms | 1500 KB | Output is correct |
11 | Correct | 1 ms | 1628 KB | Output is correct |
12 | Correct | 1 ms | 1880 KB | Output is correct |
13 | Correct | 1 ms | 1372 KB | Output is correct |
14 | Correct | 6 ms | 7516 KB | Output is correct |
15 | Correct | 3 ms | 4956 KB | Output is correct |
16 | Correct | 4 ms | 4444 KB | Output is correct |
17 | Correct | 1 ms | 604 KB | Output is correct |
18 | Correct | 8 ms | 7908 KB | Output is correct |
19 | Correct | 6 ms | 8028 KB | Output is correct |
20 | Correct | 7 ms | 7772 KB | Output is correct |
21 | Correct | 7 ms | 8028 KB | Output is correct |
22 | Correct | 6 ms | 8052 KB | Output is correct |
23 | Correct | 8 ms | 7772 KB | Output is correct |
24 | Correct | 8 ms | 8028 KB | Output is correct |
25 | Correct | 6 ms | 8028 KB | Output is correct |
26 | Correct | 6 ms | 7968 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 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 | 1 ms | 1628 KB | Output is correct |
6 | Correct | 1 ms | 1628 KB | Output is correct |
7 | Correct | 1 ms | 1372 KB | Output is correct |
8 | Correct | 1 ms | 1468 KB | Output is correct |
9 | Correct | 1 ms | 1628 KB | Output is correct |
10 | Correct | 1 ms | 1500 KB | Output is correct |
11 | Correct | 1 ms | 1628 KB | Output is correct |
12 | Correct | 1 ms | 1880 KB | Output is correct |
13 | Correct | 1 ms | 1372 KB | Output is correct |
14 | Correct | 6 ms | 7516 KB | Output is correct |
15 | Correct | 3 ms | 4956 KB | Output is correct |
16 | Correct | 4 ms | 4444 KB | Output is correct |
17 | Correct | 1 ms | 604 KB | Output is correct |
18 | Correct | 8 ms | 7908 KB | Output is correct |
19 | Correct | 6 ms | 8028 KB | Output is correct |
20 | Correct | 7 ms | 7772 KB | Output is correct |
21 | Correct | 7 ms | 8028 KB | Output is correct |
22 | Correct | 6 ms | 8052 KB | Output is correct |
23 | Correct | 8 ms | 7772 KB | Output is correct |
24 | Correct | 8 ms | 8028 KB | Output is correct |
25 | Correct | 6 ms | 8028 KB | Output is correct |
26 | Correct | 6 ms | 7968 KB | Output is correct |
27 | Correct | 191 ms | 87984 KB | Output is correct |
28 | Correct | 10 ms | 25948 KB | Output is correct |
29 | Correct | 12 ms | 7808 KB | Output is correct |
30 | Correct | 1 ms | 604 KB | Output is correct |
31 | Correct | 151 ms | 72648 KB | Output is correct |
32 | Correct | 180 ms | 88404 KB | Output is correct |
33 | Correct | 181 ms | 88144 KB | Output is correct |
34 | Correct | 166 ms | 84048 KB | Output is correct |
35 | Correct | 186 ms | 88400 KB | Output is correct |
36 | Correct | 192 ms | 88272 KB | Output is correct |
37 | Correct | 213 ms | 88512 KB | Output is correct |
38 | Correct | 140 ms | 72528 KB | Output is correct |
39 | Correct | 144 ms | 72248 KB | Output is correct |