Submission #365460

# Submission time Handle Problem Language Result Execution time Memory
365460 2021-02-11T17:22:19 Z Killer2501 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
314 ms 89068 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define task "deleg"
#define pll pair<ll, ll>
#define pii pair<ll, pll>
#define fi first
#define se second
#define ull unsigned long long
using namespace std;
const ll mod = 1e15+7;
const ll N = 3005;
const ll M = 1e6+5;
vector<ll> adj[N], sub[N];
vector<ll> kq;
ll n, m, t, k, b[N],  lab[N], u, v, h[N], a[N][N], ans, tong, d[N];
string s[N];
void sol()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i ++)
    {
        cin >> s[i];
        s[i] = " " + s[i];
    }
    for(int j = 1; j <= m; j ++)
    {
        k = 0;
        for(int i = n; i > 0; i --)
        {
            if(s[i][j] == 'I')++k;
            if(s[i][j] == 'J')a[i][j] = k;
        }
    }
    for(int i = 1; i <= n; i ++)
    {
        k = 0;
        for(int j = m; j > 0; j --)
        {
            if(s[i][j] == 'O')++k;
            if(s[i][j] == 'J')ans += a[i][j] * k;
        }
    }
    cout << ans;
}
int main()
{
    if(fopen(task".in", "r")){
       freopen(task".in", "r", stdin);
       freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int ntest = 1;
    //cin >> ntest;
    while(ntest -- > 0)
    sol();
}
// 8 5 3420
// 100000 666 505047023

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:49:15: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   49 |        freopen(task".in", "r", stdin);
      |        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:50:15: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   50 |        freopen(task".out", "w", stdout);
      |        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 620 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 1 ms 1132 KB Output is correct
6 Correct 1 ms 1004 KB Output is correct
7 Correct 1 ms 1004 KB Output is correct
8 Correct 1 ms 1132 KB Output is correct
9 Correct 2 ms 1004 KB Output is correct
10 Correct 2 ms 1004 KB Output is correct
11 Correct 1 ms 1132 KB Output is correct
12 Correct 1 ms 1004 KB Output is correct
13 Correct 1 ms 1004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 620 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 1 ms 1132 KB Output is correct
6 Correct 1 ms 1004 KB Output is correct
7 Correct 1 ms 1004 KB Output is correct
8 Correct 1 ms 1132 KB Output is correct
9 Correct 2 ms 1004 KB Output is correct
10 Correct 2 ms 1004 KB Output is correct
11 Correct 1 ms 1132 KB Output is correct
12 Correct 1 ms 1004 KB Output is correct
13 Correct 1 ms 1004 KB Output is correct
14 Correct 6 ms 4460 KB Output is correct
15 Correct 2 ms 2156 KB Output is correct
16 Correct 3 ms 2412 KB Output is correct
17 Correct 1 ms 620 KB Output is correct
18 Correct 8 ms 5100 KB Output is correct
19 Correct 6 ms 4076 KB Output is correct
20 Correct 4 ms 3692 KB Output is correct
21 Correct 8 ms 5100 KB Output is correct
22 Correct 4 ms 4332 KB Output is correct
23 Correct 4 ms 3692 KB Output is correct
24 Correct 8 ms 5100 KB Output is correct
25 Correct 5 ms 4076 KB Output is correct
26 Correct 4 ms 3692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 620 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 1 ms 1132 KB Output is correct
6 Correct 1 ms 1004 KB Output is correct
7 Correct 1 ms 1004 KB Output is correct
8 Correct 1 ms 1132 KB Output is correct
9 Correct 2 ms 1004 KB Output is correct
10 Correct 2 ms 1004 KB Output is correct
11 Correct 1 ms 1132 KB Output is correct
12 Correct 1 ms 1004 KB Output is correct
13 Correct 1 ms 1004 KB Output is correct
14 Correct 6 ms 4460 KB Output is correct
15 Correct 2 ms 2156 KB Output is correct
16 Correct 3 ms 2412 KB Output is correct
17 Correct 1 ms 620 KB Output is correct
18 Correct 8 ms 5100 KB Output is correct
19 Correct 6 ms 4076 KB Output is correct
20 Correct 4 ms 3692 KB Output is correct
21 Correct 8 ms 5100 KB Output is correct
22 Correct 4 ms 4332 KB Output is correct
23 Correct 4 ms 3692 KB Output is correct
24 Correct 8 ms 5100 KB Output is correct
25 Correct 5 ms 4076 KB Output is correct
26 Correct 4 ms 3692 KB Output is correct
27 Correct 305 ms 87864 KB Output is correct
28 Correct 6 ms 9452 KB Output is correct
29 Correct 7 ms 4844 KB Output is correct
30 Correct 1 ms 900 KB Output is correct
31 Correct 214 ms 71916 KB Output is correct
32 Correct 172 ms 66412 KB Output is correct
33 Correct 180 ms 53612 KB Output is correct
34 Correct 255 ms 83180 KB Output is correct
35 Correct 207 ms 72300 KB Output is correct
36 Correct 181 ms 53740 KB Output is correct
37 Correct 314 ms 89068 KB Output is correct
38 Correct 110 ms 49260 KB Output is correct
39 Correct 118 ms 39148 KB Output is correct