Submission #1099326

#TimeUsernameProblemLanguageResultExecution timeMemory
1099326ZflopBitaro the Brave (JOI19_ho_t1)C++14
50 / 100
134 ms43180 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 = 600; 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...