Submission #561855

#TimeUsernameProblemLanguageResultExecution timeMemory
561855dattranxxxBitaro the Brave (JOI19_ho_t1)C++11
100 / 100
95 ms18960 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; void file() { const string FILE_NAME = "FILE_NAME"; freopen((FILE_NAME + ".inp").c_str(), "r", stdin); freopen((FILE_NAME + ".out").c_str(), "w", stdout); } const int N = 3000 + 5; string s[N]; ll cnt[N]; int n, m; int main() { cin.tie(0)->sync_with_stdio(0); cout.tie(0); cin >> n >> m; for (int i = 0; i < n; ++i) cin >> s[i]; ll res = 0; for (int i = 0; i < n; ++i) { int orbs = 0; for (int j = m-1; ~j; --j) { if (s[i][j] == 'I' && cnt[j]) res += cnt[j]; else if (s[i][j] == 'O') orbs++; else if (s[i][j] == 'J') cnt[j] += orbs; } } cout << res; return 0; }

Compilation message (stderr)

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