답안 #284474

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
284474 2020-08-27T13:07:35 Z leductoan Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
340 ms 88696 KB
#include<bits/stdc++.h>
using namespace std;
#define task ""
#define lb lower_bound
#define ub upper_bound
#define ALL(v) (v).begin(),(v).end()
#define zs(v) int((v).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#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 FOR_(i,a,b) for(int i=(a),_b=(b);i<_b;++i)

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};
const ll mod=1000000007; /// 998244353
const int base=311;
const int N=3e3+5;

int n,m,g[N][N],f[N][N];
string s[N];

void biot()
{
    cin>>n>>m;
    FOR(i,1,n)
    {
        cin>>s[i];
        s[i]=' '+s[i];
    }
    FOR(j,1,m)
    {
        FORD(i,n,1)
        {
            g[i][j]=g[i+1][j];
            if(s[i][j]=='I') g[i][j]++;
        }
    }
    FOR(i,1,n)
    {
        FORD(j,m,1)
        {
            f[i][j]=f[i][j+1];
            if(s[i][j]=='O') f[i][j]++;
        }
    }
    ll ans=0;
    FOR(i,1,n)
    {
        FOR(j,1,m)
        {
            if(s[i][j]=='J') ans+=(ll)g[i][j]*f[i][j];
        }
    }
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(fopen(task".inp","r"))
    {
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    biot();
}








Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:68:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   68 |         freopen(task".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:69:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   69 |         freopen(task".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1408 KB Output is correct
6 Correct 1 ms 1280 KB Output is correct
7 Correct 1 ms 1280 KB Output is correct
8 Correct 1 ms 1408 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 1 ms 1280 KB Output is correct
11 Correct 2 ms 1408 KB Output is correct
12 Correct 1 ms 1280 KB Output is correct
13 Correct 1 ms 1280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1408 KB Output is correct
6 Correct 1 ms 1280 KB Output is correct
7 Correct 1 ms 1280 KB Output is correct
8 Correct 1 ms 1408 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 1 ms 1280 KB Output is correct
11 Correct 2 ms 1408 KB Output is correct
12 Correct 1 ms 1280 KB Output is correct
13 Correct 1 ms 1280 KB Output is correct
14 Correct 7 ms 6272 KB Output is correct
15 Correct 3 ms 3840 KB Output is correct
16 Correct 4 ms 3840 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 9 ms 6912 KB Output is correct
19 Correct 7 ms 6816 KB Output is correct
20 Correct 6 ms 6784 KB Output is correct
21 Correct 8 ms 6912 KB Output is correct
22 Correct 6 ms 6784 KB Output is correct
23 Correct 7 ms 6784 KB Output is correct
24 Correct 9 ms 6912 KB Output is correct
25 Correct 7 ms 6784 KB Output is correct
26 Correct 6 ms 6784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1408 KB Output is correct
6 Correct 1 ms 1280 KB Output is correct
7 Correct 1 ms 1280 KB Output is correct
8 Correct 1 ms 1408 KB Output is correct
9 Correct 1 ms 1408 KB Output is correct
10 Correct 1 ms 1280 KB Output is correct
11 Correct 2 ms 1408 KB Output is correct
12 Correct 1 ms 1280 KB Output is correct
13 Correct 1 ms 1280 KB Output is correct
14 Correct 7 ms 6272 KB Output is correct
15 Correct 3 ms 3840 KB Output is correct
16 Correct 4 ms 3840 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 9 ms 6912 KB Output is correct
19 Correct 7 ms 6816 KB Output is correct
20 Correct 6 ms 6784 KB Output is correct
21 Correct 8 ms 6912 KB Output is correct
22 Correct 6 ms 6784 KB Output is correct
23 Correct 7 ms 6784 KB Output is correct
24 Correct 9 ms 6912 KB Output is correct
25 Correct 7 ms 6784 KB Output is correct
26 Correct 6 ms 6784 KB Output is correct
27 Correct 303 ms 87672 KB Output is correct
28 Correct 13 ms 19328 KB Output is correct
29 Correct 10 ms 7808 KB Output is correct
30 Correct 2 ms 768 KB Output is correct
31 Correct 255 ms 71544 KB Output is correct
32 Correct 271 ms 88568 KB Output is correct
33 Correct 268 ms 88444 KB Output is correct
34 Correct 256 ms 82808 KB Output is correct
35 Correct 280 ms 88568 KB Output is correct
36 Correct 263 ms 88440 KB Output is correct
37 Correct 340 ms 88696 KB Output is correct
38 Correct 186 ms 71408 KB Output is correct
39 Correct 180 ms 71160 KB Output is correct