답안 #369263

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
369263 2021-02-21T05:03:13 Z AriaH Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
343 ms 88812 KB
/** Im the best because i work as hard as i possibly can **/

#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;

typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define endl                        "\n"

const int N = 3e3 + 10;
const ll mod = 1e9 + 7;
const ll mod2 = 998244353;
const ll inf = 8e18;
const int LOG = 22;

ll pw(ll a , ll b, ll M)  { return (!b ? 1 : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M : pw(a * a % M, b / 2, M))); }

char C[N];

string s[N];

int n, m, psO[N][N], psI[N][N];

int main()
{
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i ++)
	{
		scanf("%s", C);
		s[i] = C;
		s[i] = "#" + s[i];
		for(int j = 1; j <= m; j ++)
		{
			psO[i][j] = psO[i][j - 1] + (s[i][j] == 'O');
			psI[i][j] = psI[i - 1][j] + (s[i][j] == 'I');
		}
	}
	ll tot = 0;
	for(int i = 1; i <= n; i ++)
	{
		for(int j = 1; j <= m; j ++)
		{
			if(s[i][j] == 'J')
			{
				tot += (psO[i][m] - psO[i][j]) * (psI[n][j] - psI[i][j]);
			}
		}
	}
	printf("%lld", tot);
    return 0;
}


Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   35 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 |   scanf("%s", C);
      |   ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1260 KB Output is correct
6 Correct 1 ms 1260 KB Output is correct
7 Correct 1 ms 1280 KB Output is correct
8 Correct 1 ms 1260 KB Output is correct
9 Correct 1 ms 1260 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 2 ms 1260 KB Output is correct
12 Correct 1 ms 1260 KB Output is correct
13 Correct 1 ms 1260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1260 KB Output is correct
6 Correct 1 ms 1260 KB Output is correct
7 Correct 1 ms 1280 KB Output is correct
8 Correct 1 ms 1260 KB Output is correct
9 Correct 1 ms 1260 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 2 ms 1260 KB Output is correct
12 Correct 1 ms 1260 KB Output is correct
13 Correct 1 ms 1260 KB Output is correct
14 Correct 7 ms 6380 KB Output is correct
15 Correct 3 ms 3820 KB Output is correct
16 Correct 4 ms 3820 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 8 ms 6892 KB Output is correct
19 Correct 7 ms 6764 KB Output is correct
20 Correct 7 ms 6764 KB Output is correct
21 Correct 8 ms 6892 KB Output is correct
22 Correct 7 ms 6764 KB Output is correct
23 Correct 8 ms 6764 KB Output is correct
24 Correct 8 ms 6892 KB Output is correct
25 Correct 7 ms 6764 KB Output is correct
26 Correct 7 ms 6764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1260 KB Output is correct
6 Correct 1 ms 1260 KB Output is correct
7 Correct 1 ms 1280 KB Output is correct
8 Correct 1 ms 1260 KB Output is correct
9 Correct 1 ms 1260 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 2 ms 1260 KB Output is correct
12 Correct 1 ms 1260 KB Output is correct
13 Correct 1 ms 1260 KB Output is correct
14 Correct 7 ms 6380 KB Output is correct
15 Correct 3 ms 3820 KB Output is correct
16 Correct 4 ms 3820 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 8 ms 6892 KB Output is correct
19 Correct 7 ms 6764 KB Output is correct
20 Correct 7 ms 6764 KB Output is correct
21 Correct 8 ms 6892 KB Output is correct
22 Correct 7 ms 6764 KB Output is correct
23 Correct 8 ms 6764 KB Output is correct
24 Correct 8 ms 6892 KB Output is correct
25 Correct 7 ms 6764 KB Output is correct
26 Correct 7 ms 6764 KB Output is correct
27 Correct 343 ms 87788 KB Output is correct
28 Correct 13 ms 19308 KB Output is correct
29 Correct 10 ms 7808 KB Output is correct
30 Correct 1 ms 748 KB Output is correct
31 Correct 112 ms 71660 KB Output is correct
32 Correct 126 ms 88704 KB Output is correct
33 Correct 121 ms 88556 KB Output is correct
34 Correct 131 ms 82924 KB Output is correct
35 Correct 138 ms 88684 KB Output is correct
36 Correct 119 ms 88560 KB Output is correct
37 Correct 157 ms 88812 KB Output is correct
38 Correct 92 ms 71532 KB Output is correct
39 Correct 90 ms 71276 KB Output is correct