제출 #284474

#제출 시각아이디문제언어결과실행 시간메모리
284474leductoanBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
340 ms88696 KiB
#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();
}








컴파일 시 표준 에러 (stderr) 메시지

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);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...