Submission #1099327

#TimeUsernameProblemLanguageResultExecution timeMemory
1099327ZflopBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
271 ms161884 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define all(x) x.begin(),x.end() #define sor(x) sort(all(x)) #define pi pair<int,int> #define vi vector<int> #define int ll const int NMAX = 3010; int N,M; vector<string>A; int O[NMAX][NMAX],I[NMAX][NMAX]; void solve() { cin >> N >> M; A = vector<string>(N); for (int i = 0; i < N;++i) cin >> A[i]; for (int i = 0; i < N;++i) for (int j = 0; j < M;++j) { if (j) O[i][j] += O[i][j - 1]; if(i) I[i][j] += I[i - 1][j]; if(A[i][j] == 'O') O[i][j]++; if(A[i][j] == 'I') I[i][j]++; } int cnt = 0; for (int i = 0; i < N;++i) for (int j = 0; j < M;++j) { if(A[i][j] == 'J') cnt += (O[i][M - 1] - O[i][j]) * (I[N - 1][j] - I[i][j]); } cout << cnt; } main(){ solve(); }

Compilation message (stderr)

joi2019_ho_t1.cpp:39:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   39 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...