Submission #1082621

#TimeUsernameProblemLanguageResultExecution timeMemory
1082621lamlamlamBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
257 ms159216 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' const int MN = 3005; int n,m,cnt_o[MN][MN],cnt_i[MN][MN]; char a[MN][MN]; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #define task "sus" if(fopen(task".inp","r")){ freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } cin >> n >> m; for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ cin >> a[i][j]; if(a[i][j]=='O') cnt_o[i][j]++; if(a[i][j]=='I') cnt_i[i][j]++; } } for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ cnt_o[i][j] += cnt_o[i][j-1]; cnt_i[i][j] += cnt_i[i-1][j]; } } int ans = 0; for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) if(a[i][j]=='J') ans += (cnt_o[i][m]-cnt_o[i][j])*(cnt_i[n][j]-cnt_i[i][j]); cout << ans; cerr << "\nTime: " << clock(); }

Compilation message (stderr)

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