제출 #1118783

#제출 시각아이디문제언어결과실행 시간메모리
1118783horezusholBitaro the Brave (JOI19_ho_t1)C++14
20 / 100
9 ms13920 KiB
#include<bits/stdc++.h> #define F first #define S second #define SZ(x) int((x).size()) const char nl = '\n'; using lint = long long; using namespace std; void hotline(string name) { #ifndef ONLINE_JUDGE freopen((name + ".in").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); #endif } const int N = 3010; char a[N][N]; int n, m; int prefo[N][N]; // in string int prefi[N][N]; // in column int geto(int i, int l, int r) { int f = prefo[i][r] - prefo[i][l-1]; return f; } int geti(int j, int l, int r) { int f = prefi[r][j] - prefi[l-1][j]; return f; } void verkefni() { cin >> n >> m; for (int i = 1; i <= n; i ++) { for (int j = 1; j <= m; j ++) { cin >> a[i][j]; prefo[i][j] = prefo[i][j-1] + (a[i][j] == 'O'); } } for (int i = 1; i <= m; i ++) { for (int j = 1; j <= n; j ++) { prefi[j][i] = prefi[j-1][i] + (a[j][i] == 'I'); } } // for (int i = 1; i <= n; i ++) { // for (int j = 1; j <= m; j ++) { // cout << prefi[i][j] << " "; // } // cout << nl; // } int tot = 0; for (int i = 1; i <= n; i ++) { for (int j = 1; j <= m; j ++) { if (a[i][j] == 'J') { tot += geto(i,j,m) * geti(j,i,n); } } } cout << tot; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); // hotline("t"); int tst = 1; // cin >> tst; while (tst --) { verkefni(); cout << nl; } }

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

joi2019_ho_t1.cpp: In function 'void hotline(std::string)':
joi2019_ho_t1.cpp:10:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  freopen((name + ".in").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:11:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  freopen((name + ".out").c_str(), "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...