답안 #561855

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
561855 2022-05-13T16:29:29 Z dattranxxx Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
95 ms 18960 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void file() {
	const string FILE_NAME = "FILE_NAME";
	freopen((FILE_NAME + ".inp").c_str(), "r", stdin);
	freopen((FILE_NAME + ".out").c_str(), "w", stdout);
}
const int N = 3000 + 5;
string s[N];
ll cnt[N];
int n, m;
int main() {
	cin.tie(0)->sync_with_stdio(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
		cin >> s[i];
	ll res = 0;
	for (int i = 0; i < n; ++i) {
		int orbs = 0;
		for (int j = m-1; ~j; --j)	{
			if (s[i][j] == 'I' && cnt[j])
				res += cnt[j];
			else if (s[i][j] == 'O')
				orbs++;
			else if (s[i][j] == 'J')
				cnt[j] += orbs;
		}
	}
	cout << res;
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'void file()':
joi2019_ho_t1.cpp:6:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  freopen((FILE_NAME + ".inp").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:7:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  freopen((FILE_NAME + ".out").c_str(), "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 424 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 424 KB Output is correct
6 Correct 1 ms 428 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 424 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 424 KB Output is correct
6 Correct 1 ms 428 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 724 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 656 KB Output is correct
17 Correct 1 ms 420 KB Output is correct
18 Correct 3 ms 852 KB Output is correct
19 Correct 2 ms 852 KB Output is correct
20 Correct 2 ms 872 KB Output is correct
21 Correct 3 ms 852 KB Output is correct
22 Correct 2 ms 852 KB Output is correct
23 Correct 2 ms 896 KB Output is correct
24 Correct 3 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 1 ms 820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 424 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 424 KB Output is correct
6 Correct 1 ms 428 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 724 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 656 KB Output is correct
17 Correct 1 ms 420 KB Output is correct
18 Correct 3 ms 852 KB Output is correct
19 Correct 2 ms 852 KB Output is correct
20 Correct 2 ms 872 KB Output is correct
21 Correct 3 ms 852 KB Output is correct
22 Correct 2 ms 852 KB Output is correct
23 Correct 2 ms 896 KB Output is correct
24 Correct 3 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 1 ms 820 KB Output is correct
27 Correct 95 ms 17772 KB Output is correct
28 Correct 1 ms 428 KB Output is correct
29 Correct 3 ms 1696 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 60 ms 13184 KB Output is correct
32 Correct 38 ms 18788 KB Output is correct
33 Correct 35 ms 18836 KB Output is correct
34 Correct 72 ms 15212 KB Output is correct
35 Correct 37 ms 18764 KB Output is correct
36 Correct 29 ms 18836 KB Output is correct
37 Correct 76 ms 18960 KB Output is correct
38 Correct 30 ms 13108 KB Output is correct
39 Correct 22 ms 13100 KB Output is correct