Submission #795823

# Submission time Handle Problem Language Result Execution time Memory
795823 2023-07-27T16:31:31 Z Tien_Noob Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
214 ms 53172 KB
//Make CSP great again
//Vengeance
#include <bits/stdc++.h>
#define TASK "TESTCODE"
using namespace std;
const int N = 3001;
int a[N + 1][N + 1], n, m;
char s[N + 1][N + 1];
void read()
{
    cin >> n >> m;
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 1; j <= m; ++ j)
        {
            cin >> s[i][j];
        }
    }
}
void solve()
{   
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = m; j >= 1; -- j)
        {
            a[i][j] = a[i][j + 1];
            if (s[i][j] == 'O')
            {
                ++a[i][j];
            }
        }
    }
    long long res = 0;
    for (int j = 1; j <= m; ++ j)
    {   
        int sum = 0;
        for (int i = 1; i <= n; ++ i)
        {
            if (s[i][j] == 'J')
            {
                sum += a[i][j];
            }
            if (s[i][j] == 'I')
            {
                res += sum;
            }
        }
    }
    cout << res;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    if (fopen(TASK".INP", "r"))
    {
        freopen(TASK".INP", "r", stdin);
        //freopen(TASK".OUT", "w", stdout);
    }
    int t = 1;
    bool typetest = false;
    if (typetest)
    {
        cin >> t;
    }
    for (int __ = 1; __ <= t; ++ __)
    {
        //cout << "Case " << __ << ": ";
        read();
        solve();
    }
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:57:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   57 |         freopen(TASK".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 260 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 980 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 1 ms 980 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 1 ms 980 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 260 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 980 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 1 ms 980 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 1 ms 980 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 8 ms 4648 KB Output is correct
15 Correct 2 ms 3284 KB Output is correct
16 Correct 3 ms 2644 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 6 ms 4944 KB Output is correct
19 Correct 5 ms 4948 KB Output is correct
20 Correct 5 ms 4820 KB Output is correct
21 Correct 6 ms 4948 KB Output is correct
22 Correct 5 ms 4948 KB Output is correct
23 Correct 5 ms 4904 KB Output is correct
24 Correct 7 ms 4948 KB Output is correct
25 Correct 5 ms 4948 KB Output is correct
26 Correct 5 ms 4820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 260 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 980 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 980 KB Output is correct
10 Correct 1 ms 980 KB Output is correct
11 Correct 1 ms 980 KB Output is correct
12 Correct 1 ms 980 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 8 ms 4648 KB Output is correct
15 Correct 2 ms 3284 KB Output is correct
16 Correct 3 ms 2644 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 6 ms 4944 KB Output is correct
19 Correct 5 ms 4948 KB Output is correct
20 Correct 5 ms 4820 KB Output is correct
21 Correct 6 ms 4948 KB Output is correct
22 Correct 5 ms 4948 KB Output is correct
23 Correct 5 ms 4904 KB Output is correct
24 Correct 7 ms 4948 KB Output is correct
25 Correct 5 ms 4948 KB Output is correct
26 Correct 5 ms 4820 KB Output is correct
27 Correct 185 ms 52584 KB Output is correct
28 Correct 8 ms 16576 KB Output is correct
29 Correct 11 ms 4736 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 139 ms 43064 KB Output is correct
32 Correct 159 ms 53036 KB Output is correct
33 Correct 165 ms 52940 KB Output is correct
34 Correct 156 ms 49988 KB Output is correct
35 Correct 171 ms 53060 KB Output is correct
36 Correct 190 ms 52880 KB Output is correct
37 Correct 214 ms 53172 KB Output is correct
38 Correct 99 ms 43008 KB Output is correct
39 Correct 114 ms 42932 KB Output is correct