Submission #1258728

#TimeUsernameProblemLanguageResultExecution timeMemory
1258728hanguyenBitaro the Brave (JOI19_ho_t1)C++20
0 / 100
0 ms328 KiB
#include<bits/stdc++.h>
#define int long long
using namespace std;

const int maxn = 3005;
int row[maxn] , col[maxn];
char a[maxn][maxn];
int n ,m;   

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (fopen(".inp", "r")) {
        freopen(".inp", "r", stdin);
        freopen(".out", "w", stdout);
    }
    int res = 0;
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            cin >> a[i][j];
        }
    }
    for(int i = n; i >= 1; i--) {
        for(int j = m; j >= 1; j--) {
            if(a[i][j] == 'O') row[i]++; 
            if(a[i][j] == 'I') col[j]++;
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(a[i][j] == 'J') res += row[i] * col[j];
        }
    }
    cout << res;
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen(".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:15:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         freopen(".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...