답안 #464861

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464861 2021-08-14T10:34:00 Z jamezzz Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
754 ms 17904 KB
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#include <ext/rope>
using namespace __gnu_cxx;

typedef tree<long long, null_type, less<long long>,
rb_tree_tag, tree_order_statistics_node_update> pbds;
//less_equal for identical elements

#ifdef DEBUG
#define dbg(...) printf(__VA_ARGS__);
#else
#define dbg(...)
#endif
#define sf scanf
#define pf printf
#define fi first
#define se second
#define pb emplace_back
#define sz(x) (int)x.size()
#define mnto(x,y) x=min(x,(__typeof__(x))y)
#define mxto(x,y) x=max(x,(__typeof__(x))y)
#define INF 1023456789
#define LINF 1023456789123456789
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vll;
mt19937 rng(time(0));

int h,w,o[3005];
char c[3005][3005];

int main(){
	sf("%d%d",&h,&w);
	for(int i=0;i<h;++i){
		for(int j=0;j<w;++j){
			sf(" %c",&c[i][j]);
		}
	}
	ll ans=0;
	for(int j=w-1;j>=0;--j){
		int cnt=0;
		for(int i=h-1;i>=0;--i){
			if(c[i][j]=='J')ans+=cnt*o[i];
			if(c[i][j]=='O')++o[i];
			if(c[i][j]=='I')++cnt;
		}
	}
	pf("%lld\n",ans);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:44:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |  sf("%d%d",&h,&w);
      |    ^
joi2019_ho_t1.cpp:47:6: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |    sf(" %c",&c[i][j]);
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 588 KB Output is correct
8 Correct 1 ms 588 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 1 ms 588 KB Output is correct
11 Correct 2 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 588 KB Output is correct
8 Correct 1 ms 588 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 1 ms 588 KB Output is correct
11 Correct 2 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 588 KB Output is correct
14 Correct 14 ms 1912 KB Output is correct
15 Correct 2 ms 1484 KB Output is correct
16 Correct 9 ms 1100 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 18 ms 2016 KB Output is correct
19 Correct 22 ms 2008 KB Output is correct
20 Correct 20 ms 1944 KB Output is correct
21 Correct 20 ms 1940 KB Output is correct
22 Correct 16 ms 1996 KB Output is correct
23 Correct 16 ms 1868 KB Output is correct
24 Correct 18 ms 2012 KB Output is correct
25 Correct 16 ms 1996 KB Output is correct
26 Correct 16 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 588 KB Output is correct
8 Correct 1 ms 588 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 1 ms 588 KB Output is correct
11 Correct 2 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 588 KB Output is correct
14 Correct 14 ms 1912 KB Output is correct
15 Correct 2 ms 1484 KB Output is correct
16 Correct 9 ms 1100 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 18 ms 2016 KB Output is correct
19 Correct 22 ms 2008 KB Output is correct
20 Correct 20 ms 1944 KB Output is correct
21 Correct 20 ms 1940 KB Output is correct
22 Correct 16 ms 1996 KB Output is correct
23 Correct 16 ms 1868 KB Output is correct
24 Correct 18 ms 2012 KB Output is correct
25 Correct 16 ms 1996 KB Output is correct
26 Correct 16 ms 1868 KB Output is correct
27 Correct 606 ms 17444 KB Output is correct
28 Correct 5 ms 7116 KB Output is correct
29 Correct 41 ms 1624 KB Output is correct
30 Correct 2 ms 316 KB Output is correct
31 Correct 432 ms 13756 KB Output is correct
32 Correct 589 ms 17816 KB Output is correct
33 Correct 577 ms 17904 KB Output is correct
34 Correct 507 ms 15884 KB Output is correct
35 Correct 588 ms 17864 KB Output is correct
36 Correct 580 ms 17848 KB Output is correct
37 Correct 754 ms 17808 KB Output is correct
38 Correct 422 ms 13708 KB Output is correct
39 Correct 416 ms 13700 KB Output is correct