Submission #530484

# Submission time Handle Problem Language Result Execution time Memory
530484 2022-02-25T14:07:56 Z aSSSd Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
201 ms 88636 KB
//#pragma GCC optimize("O2,unroll-loops")
//#pragma GCC target("avx,avx2")
#include <bits/stdc++.h>
using namespace std;
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r)
{
    return l+rng()%(r-l+1);
}
#define fasty ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define forinc(x,a,b) for(int x=a;x<=b;x++)
#define fordec(x,a,b) for(int x=a;x>=b;x--)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<long long,long long>
#define getbit(x,i) ((x>>(i))&1)
#define batbit(x,i) (x|(1ll<<(i)))
#define tatbit(x,i) (x&~(1<<(i)))
#define gg exit(0);
#define all(a) a.begin() , a.end()
const int N = 3010;
char a[N][N];
int m , n;
int cntO[N][N];
int cntI[N][N];
main()
{
    fasty;
    cin >> m >> n;
    forinc(i,1,m) forinc(j,1,n) cin >> a[i][j];
    long long tot=0;
    forinc(i,1,m) fordec(j,n,1)
    {
       if(a[i][j] == 'O') cntO[i][j] = cntO[i][j+1] + 1;
       else cntO[i][j] = cntO[i][j+1];
    }
    fordec(i,m,1) forinc(j,1,n)
    {
      if(a[i][j] == 'I')  cntI[i][j] = cntI[i+1][j] + 1;
      else cntI[i][j] = cntI[i+1][j];
    }
    forinc(i,1,m) forinc(j,1,n) if(a[i][j] == 'J')
    {
        tot += cntI[i][j] * cntO[i][j];
    }
    cout << tot;

}

Compilation message

joi2019_ho_t1.cpp:29:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   29 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1472 KB Output is correct
7 Correct 2 ms 1356 KB Output is correct
8 Correct 1 ms 1472 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1336 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 2 ms 1484 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1472 KB Output is correct
7 Correct 2 ms 1356 KB Output is correct
8 Correct 1 ms 1472 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1336 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 2 ms 1484 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 7 ms 7460 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 4 ms 4300 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 8 ms 8008 KB Output is correct
19 Correct 7 ms 7876 KB Output is correct
20 Correct 8 ms 7856 KB Output is correct
21 Correct 10 ms 8000 KB Output is correct
22 Correct 8 ms 7872 KB Output is correct
23 Correct 8 ms 7756 KB Output is correct
24 Correct 10 ms 8016 KB Output is correct
25 Correct 7 ms 7884 KB Output is correct
26 Correct 7 ms 7884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1472 KB Output is correct
7 Correct 2 ms 1356 KB Output is correct
8 Correct 1 ms 1472 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1336 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 2 ms 1484 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 7 ms 7460 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 4 ms 4300 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 8 ms 8008 KB Output is correct
19 Correct 7 ms 7876 KB Output is correct
20 Correct 8 ms 7856 KB Output is correct
21 Correct 10 ms 8000 KB Output is correct
22 Correct 8 ms 7872 KB Output is correct
23 Correct 8 ms 7756 KB Output is correct
24 Correct 10 ms 8016 KB Output is correct
25 Correct 7 ms 7884 KB Output is correct
26 Correct 7 ms 7884 KB Output is correct
27 Correct 197 ms 88124 KB Output is correct
28 Correct 12 ms 25936 KB Output is correct
29 Correct 14 ms 7792 KB Output is correct
30 Correct 1 ms 588 KB Output is correct
31 Correct 142 ms 72644 KB Output is correct
32 Correct 176 ms 88604 KB Output is correct
33 Correct 187 ms 88252 KB Output is correct
34 Correct 168 ms 84292 KB Output is correct
35 Correct 179 ms 88564 KB Output is correct
36 Correct 167 ms 88352 KB Output is correct
37 Correct 201 ms 88636 KB Output is correct
38 Correct 121 ms 72596 KB Output is correct
39 Correct 120 ms 72296 KB Output is correct