Submission #199765

#TimeUsernameProblemLanguageResultExecution timeMemory
199765MercenaryBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
114 ms89592 KiB
#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
const int maxn = 3005;
string s[maxn];
int a[maxn][maxn] , b[maxn][maxn] , m , n;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    ll res = 0;
    cin >> m >> n;
    for(int i = 0 ; i < m ; ++i)cin >> s[i];
    for(int i = m - 1 ; i >= 0 ; --i){
        for(int j = n - 1 ; j >= 0 ; --j){
            a[i][j] = a[i][j + 1] + (s[i][j] == 'O');
            b[i][j] = b[i + 1][j] + (s[i][j] == 'I');
        }
    }
    for(int i = 0 ; i < m ; ++i){
        for(int j = 0 ; j < n ; ++j){
            res += (ll)(s[i][j] == 'J') * a[i][j] * b[i][j];
        }
    }
    cout << res;
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:20:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen(taskname".INP", "r",stdin);
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:21:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen(taskname".OUT", "w",stdout);
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...