답안 #753054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
753054 2023-06-04T13:58:44 Z CdS Bitaro the Brave (JOI19_ho_t1) C++17
20 / 100
53 ms 2568 KB
#include <bits/stdc++.h>

using namespace std;

char grid[3002][3002];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int h, w;

    cin >> h >> w;

    vector<pair<int, int>> joia;
    map<int, vector<int>> orbe;
    map<int, vector<int>> ingo;

    for (int i = 1; i <= h; i++)
    {
	for (int j = 1; j <= w; j++)
	{
	    char x;
	    cin >> x;
	    if (x == 'J') 
	    {
		joia.push_back({i, j});
	    }
	    if (x == 'O') 
	    {
		if (orbe.find(i) == orbe.end())
		{
		    vector<int> k;
		    orbe[i] = k;
		}
		orbe[i].push_back(j);
	    }
	    if (x == 'I')
	    {
		if (ingo.find(j) == orbe.end())
		{
		    vector<int> k;
		    ingo[j] = k;
		}
		ingo[j].push_back(i);
	    }
	}
    }

    int ans = 0;
    int a= 0, b= 0;

    for (auto k : joia)
    {
	a = 0;
	b = 0;
	
	//cout << "( " << k.first << " , " << k.second << " )\n";
	//cout << "l: ";
	
	for (auto o : orbe[k.first])
	{
	   //cout << o << " ";
	   if (k.second < o) a++;
        }
	
	//cout << "\n";
	//cout << "k: ";
	
	for (auto i : ingo[k.second])
	{
	    //cout << i << " ";
	    if (k.first < i) b++;
	}
	if (ingo[k.second].size() == 0 || orbe[k.first].size() == 0)
	{
	    a = 0;
	    b = 0;
	}
	
	//cout << "\n";
	//cout << a << ", " << b << "\n";
	ans += a*b;
    }

    cout << ans;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 51 ms 1868 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 18 ms 1372 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 53 ms 2568 KB Output is correct
19 Correct 30 ms 2016 KB Output is correct
20 Incorrect 50 ms 2008 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 51 ms 1868 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 18 ms 1372 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 53 ms 2568 KB Output is correct
19 Correct 30 ms 2016 KB Output is correct
20 Incorrect 50 ms 2008 KB Output isn't correct
21 Halted 0 ms 0 KB -