Submission #1112301

# Submission time Handle Problem Language Result Execution time Memory
1112301 2024-11-14T03:22:06 Z whyalwaysmezzz Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
306 ms 207192 KB
//Nếu thế giới có 8 tỷ người yêu em, anh là một trong số họ
//Nếu thế giới có 1 người yêu em, thì anh chính là người đó
//Nếu thế giới không còn ai yêu em, thì có nghĩa là anh đã chết </3
//dyk19b1
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; i--)
#define BIT(mask,i) ((mask >> i) & 1ll )
#define endl '\n'  
#define all(x) x.begin(),x.end()
#define ii pair <int,int> 
using namespace std;
#define read doc() 
int doc () {bool minus = false;int result = 0;char ch;ch = getchar();while (true) {if (ch == '-') break;if (ch >= '0' && ch <= '9') break;ch = getchar();}if (ch == '-') minus = true; else result = ch-'0';while (true) {ch = getchar();if (ch < '0' || ch > '9') break;result = result*10 + (ch - '0');}if (minus)return -result;else return result;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <class T> T rand(T l, T h) { return uniform_int_distribution <T> (l, h) (rng); } 
template <class T> T rand(T h) { return uniform_int_distribution <T> (0, h - 1) (rng); }
template<class X, class Y>bool minimize(X &x, const Y &y) {if (x > y) {x = y;return true;} else return false;}
template<class X, class Y>bool maximize(X &x, const Y &y) {if (x < y) {x = y;return true;} else return false;}
const long long oo = 1e18;
const int N = 3005+5;
const int MOD = 1e9+7;
vector <ii> J;
int O[N][N],I[N][N];
void TnKh()
{
	int n,m;
	cin >> n >> m;
	FOR(i,1,n) FOR(j,1,m) 
	{
		char x;
		cin >> x;

    	if (x == 'J') J.push_back({i,j});
    	if (x == 'O') O[i][j]++;
    	if (x == 'I') I[i][j]++;
    }
    FOR(i,1,n) 
    FORD(j,m-1,1) 
    {
    	O[i][j] += O[i][j+1];
    }
    FOR(j,1,m)
    FORD(i,n-1,1)  
    {
    	I[i][j] += I[i+1][j];
    }
    int ans = 0;
    for(auto [i,j]:J)
    {
    	ans += O[i][j+1] * I[i+1][j];
    }
    cout << ans;
    return;
}
#define TASK "task"
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 //   freopen(TASK".inp","r",stdin);freopen(TASK".out","w",stdout);
    int Dyk19b1 = 1;
    // cin >> Dyk19b1;
    while (Dyk19b1--) TnKh();
    return 0;       
}





Compilation message

joi2019_ho_t1.cpp: In function 'void TnKh()':
joi2019_ho_t1.cpp:52:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   52 |     for(auto [i,j]:J)
      |              ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 4572 KB Output is correct
5 Correct 2 ms 8784 KB Output is correct
6 Correct 2 ms 8528 KB Output is correct
7 Correct 2 ms 6736 KB Output is correct
8 Correct 2 ms 8784 KB Output is correct
9 Correct 2 ms 8784 KB Output is correct
10 Correct 1 ms 6736 KB Output is correct
11 Correct 2 ms 8784 KB Output is correct
12 Correct 3 ms 8528 KB Output is correct
13 Correct 2 ms 6736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 4572 KB Output is correct
5 Correct 2 ms 8784 KB Output is correct
6 Correct 2 ms 8528 KB Output is correct
7 Correct 2 ms 6736 KB Output is correct
8 Correct 2 ms 8784 KB Output is correct
9 Correct 2 ms 8784 KB Output is correct
10 Correct 1 ms 6736 KB Output is correct
11 Correct 2 ms 8784 KB Output is correct
12 Correct 3 ms 8528 KB Output is correct
13 Correct 2 ms 6736 KB Output is correct
14 Correct 10 ms 28364 KB Output is correct
15 Correct 3 ms 21072 KB Output is correct
16 Correct 6 ms 15820 KB Output is correct
17 Correct 2 ms 4432 KB Output is correct
18 Correct 11 ms 29416 KB Output is correct
19 Correct 7 ms 27856 KB Output is correct
20 Correct 8 ms 29384 KB Output is correct
21 Correct 10 ms 29392 KB Output is correct
22 Correct 9 ms 29384 KB Output is correct
23 Correct 9 ms 29552 KB Output is correct
24 Correct 14 ms 29384 KB Output is correct
25 Correct 6 ms 28028 KB Output is correct
26 Correct 8 ms 29384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 4572 KB Output is correct
5 Correct 2 ms 8784 KB Output is correct
6 Correct 2 ms 8528 KB Output is correct
7 Correct 2 ms 6736 KB Output is correct
8 Correct 2 ms 8784 KB Output is correct
9 Correct 2 ms 8784 KB Output is correct
10 Correct 1 ms 6736 KB Output is correct
11 Correct 2 ms 8784 KB Output is correct
12 Correct 3 ms 8528 KB Output is correct
13 Correct 2 ms 6736 KB Output is correct
14 Correct 10 ms 28364 KB Output is correct
15 Correct 3 ms 21072 KB Output is correct
16 Correct 6 ms 15820 KB Output is correct
17 Correct 2 ms 4432 KB Output is correct
18 Correct 11 ms 29416 KB Output is correct
19 Correct 7 ms 27856 KB Output is correct
20 Correct 8 ms 29384 KB Output is correct
21 Correct 10 ms 29392 KB Output is correct
22 Correct 9 ms 29384 KB Output is correct
23 Correct 9 ms 29552 KB Output is correct
24 Correct 14 ms 29384 KB Output is correct
25 Correct 6 ms 28028 KB Output is correct
26 Correct 8 ms 29384 KB Output is correct
27 Correct 281 ms 194184 KB Output is correct
28 Correct 11 ms 106452 KB Output is correct
29 Correct 11 ms 19652 KB Output is correct
30 Correct 2 ms 4972 KB Output is correct
31 Correct 197 ms 157596 KB Output is correct
32 Correct 172 ms 164232 KB Output is correct
33 Correct 208 ms 197500 KB Output is correct
34 Correct 271 ms 193440 KB Output is correct
35 Correct 222 ms 196484 KB Output is correct
36 Correct 216 ms 197524 KB Output is correct
37 Correct 306 ms 207192 KB Output is correct
38 Correct 142 ms 135592 KB Output is correct
39 Correct 137 ms 157604 KB Output is correct