제출 #1086317

#제출 시각아이디문제언어결과실행 시간메모리
1086317kiethm07Bitaro the Brave (JOI19_ho_t1)C++11
100 / 100
213 ms88512 KiB
#include <bits/stdc++.h>

#define pii pair<int,int>
#define iii pair<int,pii>
#define fi first
#define se second

#define vi vector<int>
#define all(x) x.begin(),x.end()

#define TEXT "a"

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9 + 7;
const ld eps = 1e-8;
const double pi = acos(-1);
const int N = 3005;

int n,m;
char a[N][N];
int row[N][N], col[N][N];

int main(){
    cin.tie(0) -> sync_with_stdio(0);
    if (fopen(TEXT".inp","r")){
        freopen(TEXT".inp","r",stdin);
        freopen(TEXT".out","w",stdout);
    }
    cin >> n >> m;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++) cin >> a[i][j];
    }
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            col[i][j] = col[i][j - 1] + (a[i][j] == 'O');
        }
    }
    for (int j = 1; j <= m; j++){
        for (int i = 1; i <= n; i++){
            row[i][j] = row[i - 1][j] + (a[i][j] == 'I');
        }
    }
    ll res = 0;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            if (a[i][j] != 'J') continue;
            ll x = row[n][j] - row[i][j];
            ll y = col[i][m] - col[i][j];
            res += x * y;
        }
    }
    cout << res << "\n";
    return 0;
}

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

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