답안 #580241

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
580241 2022-06-20T19:25:21 Z HeyYouNotYouYou Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
1000 ms 123048 KB
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
const int N = 3001,INF=1e12;
char arr[N][N];
vector<pair<int,int>>jew;
vector<int>ob[N],col[N];
int32_t main()
{
  //freopen("abc.in", "r", stdin);
  int h , w;
  cin >> h >> w;
  for(int i = 0 ; i < h  ; i ++){
    for(int j = 0 ; j < w; j ++){
      cin>>arr[i][j];
      if(arr[i][j]=='J'){
        jew.push_back({i,j});
      }
      else if(arr[i][j]=='O')
        ob[i].push_back(j);
      else if(arr[i][j]=='I'){
        col[j].push_back(i);
      }
    }
  }
  int ans=0;
  for(auto e : jew)
  {
    auto it = lower_bound(ob[e.first].begin(),ob[e.first].end(),e.second);
    auto it2 = lower_bound(col[e.second].begin(),col[e.second].end(),e.first);
    ans+=(ob[e.first].size()-(it-ob[e.first].begin())) * (col[e.second].size()-(it2-col[e.second].begin()));
  }
  cout<<ans<<endl;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 2 ms 852 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 1 ms 852 KB Output is correct
8 Correct 2 ms 844 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 2 ms 852 KB Output is correct
12 Correct 1 ms 852 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 2 ms 852 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 1 ms 852 KB Output is correct
8 Correct 2 ms 844 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 2 ms 852 KB Output is correct
12 Correct 1 ms 852 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 23 ms 4752 KB Output is correct
15 Correct 1 ms 1748 KB Output is correct
16 Correct 12 ms 2892 KB Output is correct
17 Correct 1 ms 444 KB Output is correct
18 Correct 26 ms 5776 KB Output is correct
19 Correct 21 ms 4888 KB Output is correct
20 Correct 31 ms 4756 KB Output is correct
21 Correct 27 ms 5816 KB Output is correct
22 Correct 23 ms 5180 KB Output is correct
23 Correct 23 ms 4660 KB Output is correct
24 Correct 31 ms 5308 KB Output is correct
25 Correct 20 ms 4780 KB Output is correct
26 Correct 19 ms 4676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 2 ms 852 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 1 ms 852 KB Output is correct
8 Correct 2 ms 844 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 2 ms 852 KB Output is correct
12 Correct 1 ms 852 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 23 ms 4752 KB Output is correct
15 Correct 1 ms 1748 KB Output is correct
16 Correct 12 ms 2892 KB Output is correct
17 Correct 1 ms 444 KB Output is correct
18 Correct 26 ms 5776 KB Output is correct
19 Correct 21 ms 4888 KB Output is correct
20 Correct 31 ms 4756 KB Output is correct
21 Correct 27 ms 5816 KB Output is correct
22 Correct 23 ms 5180 KB Output is correct
23 Correct 23 ms 4660 KB Output is correct
24 Correct 31 ms 5308 KB Output is correct
25 Correct 20 ms 4780 KB Output is correct
26 Correct 19 ms 4676 KB Output is correct
27 Execution timed out 1029 ms 123048 KB Time limit exceeded
28 Halted 0 ms 0 KB -