답안 #913555

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
913555 2024-01-20T08:21:08 Z ashkan_ahmadi_koni Bitaro the Brave (JOI19_ho_t1) C++17
20 / 100
1000 ms 5824 KB
/*               In The Name Of God               */
#include                              <bits/stdc++.h>
using                                  namespace std;
#define int                                 long long
#define sw                            sync_with_stdio
#pragma GCC       optimize("Ofast, unroll-loops, O3")
#define fast       ios::sw(0),cin.tie(0),cout.tie(0);
const int   N = 3e3 + 3, M = 1e9 + 7, inf = 1e18 + 8; 

int h, w, ans;
char a[N][N];

vector <pair<int, int>> ii, jj, oo;

signed main() {
    fast; cin >> h >> w;
    
     for (int i = 1; i <= h; ++i)
    	for (int j = 1; j <= w; ++j) {
    		cin >> a[i][j];
    		
    		if (a[i][j] == 'I')
    			ii.push_back({i, j});
    		else if (a[i][j] == 'J')
    			jj.push_back({i, j});
    		else
    			oo.push_back({i, j});
    	}
    	
	for (auto[i, j] : jj) 
		for (auto [x, y] : oo) 
			if (x == i && j < y) 
				for (auto [a, b] : ii)
					if (b == j && i < a) {
						ans++;
						// cout << i << ' ' << j << ' ' << a << ' ' << y << '\n';
					}
    					
    cout << ans << '\n';
    
}

/* 

    .---.    .    .--.         
    |        |    |   ) o      
    |--- .--.|--. |--:  .  ---.
    |    `--.|  | |   ) |   .' 
    '---'`--''  `-'--'-' `-'--- 

*/

Compilation message

joi2019_ho_t1.cpp:6:53: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas]
    6 | #pragma GCC       optimize("Ofast, unroll-loops, O3")
      |                                                     ^
joi2019_ho_t1.cpp:6:53: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
joi2019_ho_t1.cpp:15:13: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
   15 | signed main() {
      |             ^
joi2019_ho_t1.cpp:15:13: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:18:6: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   18 |      for (int i = 1; i <= h; ++i)
      |      ^~~
joi2019_ho_t1.cpp:30:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 |  for (auto[i, j] : jj)
      |  ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Correct 204 ms 2972 KB Output is correct
6 Correct 23 ms 2652 KB Output is correct
7 Correct 329 ms 2908 KB Output is correct
8 Correct 144 ms 2932 KB Output is correct
9 Correct 60 ms 3060 KB Output is correct
10 Correct 315 ms 2916 KB Output is correct
11 Correct 134 ms 2928 KB Output is correct
12 Correct 34 ms 3160 KB Output is correct
13 Correct 315 ms 2912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Correct 204 ms 2972 KB Output is correct
6 Correct 23 ms 2652 KB Output is correct
7 Correct 329 ms 2908 KB Output is correct
8 Correct 144 ms 2932 KB Output is correct
9 Correct 60 ms 3060 KB Output is correct
10 Correct 315 ms 2916 KB Output is correct
11 Correct 134 ms 2928 KB Output is correct
12 Correct 34 ms 3160 KB Output is correct
13 Correct 315 ms 2912 KB Output is correct
14 Execution timed out 1037 ms 5824 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Correct 204 ms 2972 KB Output is correct
6 Correct 23 ms 2652 KB Output is correct
7 Correct 329 ms 2908 KB Output is correct
8 Correct 144 ms 2932 KB Output is correct
9 Correct 60 ms 3060 KB Output is correct
10 Correct 315 ms 2916 KB Output is correct
11 Correct 134 ms 2928 KB Output is correct
12 Correct 34 ms 3160 KB Output is correct
13 Correct 315 ms 2912 KB Output is correct
14 Execution timed out 1037 ms 5824 KB Time limit exceeded
15 Halted 0 ms 0 KB -