Submission #365460

#TimeUsernameProblemLanguageResultExecution timeMemory
365460Killer2501Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
314 ms89068 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define task "deleg" #define pll pair<ll, ll> #define pii pair<ll, pll> #define fi first #define se second #define ull unsigned long long using namespace std; const ll mod = 1e15+7; const ll N = 3005; const ll M = 1e6+5; vector<ll> adj[N], sub[N]; vector<ll> kq; ll n, m, t, k, b[N], lab[N], u, v, h[N], a[N][N], ans, tong, d[N]; string s[N]; void sol() { cin >> n >> m; for(int i = 1; i <= n; i ++) { cin >> s[i]; s[i] = " " + s[i]; } for(int j = 1; j <= m; j ++) { k = 0; for(int i = n; i > 0; i --) { if(s[i][j] == 'I')++k; if(s[i][j] == 'J')a[i][j] = k; } } for(int i = 1; i <= n; i ++) { k = 0; for(int j = m; j > 0; j --) { if(s[i][j] == 'O')++k; if(s[i][j] == 'J')ans += a[i][j] * k; } } cout << ans; } int main() { if(fopen(task".in", "r")){ freopen(task".in", "r", stdin); freopen(task".out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int ntest = 1; //cin >> ntest; while(ntest -- > 0) sol(); } // 8 5 3420 // 100000 666 505047023

Compilation message (stderr)

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