Submission #151097

#TimeUsernameProblemLanguageResultExecution timeMemory
151097karmaBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
93 ms10232 KiB
#include <bits/stdc++.h> #define ll long long #define pb emplace_back #define mp make_pair #define fi first #define se second using namespace std; const int N = int(3e3) + 1; const int mod = int(1e9) + 7; string s[N]; ll res = 0; int n, m, c[N], cur; int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); if(fopen("test.inp", "r")) { freopen("test.inp", "r", stdin); freopen("test.out", "w", stdout); } cin >> n >> m; for(int i = 0; i < n; ++i) cin >> s[i]; for(int i = n - 1; i >= 0; --i) { cur = 0; for(int j = 0; j < m; ++j) { if(s[i][j] == 'J') cur += c[j]; else if(s[i][j] == 'I') ++c[j]; else res += cur; } } cout << res; }

Compilation message (stderr)

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