Submission #1023572

#TimeUsernameProblemLanguageResultExecution timeMemory
1023572vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
202 ms79704 KiB
#include <bits/stdc++.h> #define ll long long #define ld long double #define eb emplace_back #define task "" #define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout); #define fi first #define se second #define pii pair <int, int> #define tii tuple <int, int, int> #define all(s) s.begin(), s.end() using namespace std; const int nmax = 3e3 + 2; int h, w; char s[nmax][nmax]; int cntO[nmax][nmax], cntI[nmax][nmax]; int main() { if (ifstream(task".inp")) nx fast cin >> h >> w; for (int i = 1; i <= h; ++i) for (int j = 1; j <= w; ++j) cin >> s[i][j]; for (int i = 1; i <= h; ++i) for (int j = w; j >= 1; --j) cntO[i][j] = cntO[i][j + 1] + (s[i][j] == 'O'); for (int j = 1; j <= w; ++j) for (int i = h; i >= 1; --i) cntI[j][i] = cntI[j][i + 1] + (s[i][j] == 'I'); ll ans = 0; for (int i = 1; i <= h; ++i) for (int j = 1; j <= w; ++j) if (s[i][j] == 'J') ans += cntO[i][j] * cntI[j][i]; cout << ans; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:7:20: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout);
      |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:23:31: note: in expansion of macro 'nx'
   23 |     if (ifstream(task".inp")) nx
      |                               ^~
joi2019_ho_t1.cpp:7:52: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout);
      |                                            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:23:31: note: in expansion of macro 'nx'
   23 |     if (ifstream(task".inp")) nx
      |                               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...