Submission #1023567

#TimeUsernameProblemLanguageResultExecution timeMemory
1023567vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
193 ms88184 KiB
#include <bits/stdc++.h> using namespace std; #define task "test" #define FOR(i, a, b) for(int i = (a); i <= (b); ++i) #define FORD(i, a, b) for(int i = (a); i >= (b); --i) #define sz(a) (int)(a).size() #define all(a) (a).begin(), (a).end() #define bit(s, i) (((s) >> (i)) & 1) #define ii pair <int, int> #define vii vector <ii> #define vi vector <int> #define fi first #define se second #define ll long long #define eb emplace_back #define pb push_back #define __builtin_popcount __builtin_popcountll void solve(); int32_t main() { if(fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } cin.tie(0)->sync_with_stdio(0); int tc = 1; // cin >> tc; FOR(i, 1, tc) { solve(); } } const int N = 3300; int h, w, cnto[N][N], cnti[N][N]; char a[N][N]; void solve() { cin >> h >> w; FOR(i, 1, h) FOR(j, 1, w) cin >> a[i][j]; FOR(i, 1, h) FORD(j, w, 1) { cnto[i][j] = cnto[i][j+1] + (a[i][j] == 'O'); } FOR(i, 1, w) FORD(j, h, 1) { cnti[j][i] = cnti[j+1][i] + (a[j][i] == 'I'); } ll ans = 0; FOR(i, 1, h) FOR(j, 1, w) if(a[i][j] == 'J') { ans = ans + 1ll*cnto[i][j]*cnti[i][j]; } cout << ans; }

Compilation message (stderr)

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