답안 #546672

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
546672 2022-04-08T04:32:30 Z Aktan Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
939 ms 17808 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template<class T>
using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define ft first
#define sc second
const int mod=1e9+7,INF=1e17,N=3005;

char s[N][N];
map<int,int> mp,mp1;
main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n,m;
	cin >> n >> m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin >> s[i][j];
			if(s[i][j]=='O'){
				mp1[i]++;
			}
			if(s[i][j]=='I'){
				mp[j]++;
			}
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(s[i][j]=='J'){
				ans+=(mp1[i]*mp[j]);
			}
			if(s[i][j]=='O'){
				mp1[i]--;
			}
			if(s[i][j]=='I'){
				mp[j]--;
			}
		}
	}
	cout << ans;
	
}



Compilation message

joi2019_ho_t1.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 1 ms 572 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 1 ms 572 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 20 ms 2004 KB Output is correct
15 Correct 2 ms 1492 KB Output is correct
16 Correct 10 ms 1236 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 24 ms 2104 KB Output is correct
19 Correct 17 ms 1976 KB Output is correct
20 Correct 14 ms 2004 KB Output is correct
21 Correct 23 ms 2068 KB Output is correct
22 Correct 18 ms 2008 KB Output is correct
23 Correct 15 ms 2004 KB Output is correct
24 Correct 28 ms 2004 KB Output is correct
25 Correct 17 ms 2008 KB Output is correct
26 Correct 15 ms 2004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 1 ms 572 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 20 ms 2004 KB Output is correct
15 Correct 2 ms 1492 KB Output is correct
16 Correct 10 ms 1236 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 24 ms 2104 KB Output is correct
19 Correct 17 ms 1976 KB Output is correct
20 Correct 14 ms 2004 KB Output is correct
21 Correct 23 ms 2068 KB Output is correct
22 Correct 18 ms 2008 KB Output is correct
23 Correct 15 ms 2004 KB Output is correct
24 Correct 28 ms 2004 KB Output is correct
25 Correct 17 ms 2008 KB Output is correct
26 Correct 15 ms 2004 KB Output is correct
27 Correct 939 ms 17808 KB Output is correct
28 Correct 5 ms 7380 KB Output is correct
29 Correct 46 ms 1904 KB Output is correct
30 Correct 3 ms 468 KB Output is correct
31 Correct 687 ms 11796 KB Output is correct
32 Correct 853 ms 13428 KB Output is correct
33 Correct 662 ms 13296 KB Output is correct
34 Correct 784 ms 12996 KB Output is correct
35 Correct 832 ms 13388 KB Output is correct
36 Correct 623 ms 13356 KB Output is correct
37 Correct 905 ms 13332 KB Output is correct
38 Correct 501 ms 11812 KB Output is correct
39 Correct 426 ms 11884 KB Output is correct