답안 #976628

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976628 2024-05-06T22:31:39 Z thegamercoder19 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
68 ms 19092 KB
/*
Coded by thegamercoder
Happy Competition and Hacking
*/


#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#define M_PI       3.14159265358979323846
#define FILER 0
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = pow(10, 9) + 7;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const ull INFUL = 0x3f3f3f3f3f3f3f3f;
const ll INFT = 0x3f3f3f3f;
const ll MAX = 401;
const ll MODD = 998244353;
const ll BL = 1;
const double EPS = 1e-10;
#define V vector
#define pll pair<ll, ll>
#define pull2 pair<ull,ull>
#define MS multiset
#define M map
#define Q queue
#define PQ priority_queue
#define IOF ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FOR(typ,i,a,b,c) for(typ i = a; i < b; i += c)
#define FORR(typ,i,a,b,c) for(typ i = a; i > b; i -= c)
#define FORA(a,i) for(auto i : a)
#define FORAE(a,i) for(auto &i : a)
#define all(v) v.begin(),v.end()
#define sorta(a) sort(all(a))
#define sortd(a) sort(all(a), greater<ll>())
#define setp(x) setprecision(x)<<fixed
#define RET return
#define log(a,b) log(b)/log(a)
#define WH(s) while(s)
#define WHI(t) WH(t--)
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define YESNO(s) cout<<(s?"YES":"NO")<<endl;
#define YesNo(s) cout<<(s?"Yes":"No")<<endl;
#define TYP 0
using namespace std;
V<string> g;
V<ll> ih;
ll n, m, ans, c = 0;
void solve()
{
    cin >> n >> m;
    g.resize(n); ih.resize(m);
    FOR(ll, i, 0, n, 1)cin >> g[i];
    FORR(ll, i, n - 1, -1, 1)
    {
        c = 0;
        FORR(ll, j, m - 1, -1, 1)
        {
            if (g[i][j] == 'J') ans += c * ih[j];
            else if (g[i][j] == 'O')c++;
            else ih[j]++;
        }
    }
       
       
    cout << ans << endl;
}
void init()
{

    if (FILER)
    {
        freopen("pump.in", "r", stdin);
        freopen("pump.out", "w", stdout);
    }
}

void handle()
{
    init();
    ll t = 1;
    if (TYP)cin >> t;
    WHI(t)solve();
}

int main()
{
    IOF
        handle();
    RET 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'void init()':
joi2019_ho_t1.cpp:78:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   78 |         freopen("pump.in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:79:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   79 |         freopen("pump.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 2 ms 1112 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 2 ms 988 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 860 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 1 ms 856 KB Output is correct
23 Correct 1 ms 860 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 1 ms 860 KB Output is correct
26 Correct 2 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 2 ms 1112 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 2 ms 988 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 860 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 1 ms 856 KB Output is correct
23 Correct 1 ms 860 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 1 ms 860 KB Output is correct
26 Correct 2 ms 860 KB Output is correct
27 Correct 68 ms 14024 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 3 ms 1628 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 52 ms 13308 KB Output is correct
32 Correct 32 ms 18876 KB Output is correct
33 Correct 34 ms 19028 KB Output is correct
34 Correct 57 ms 15356 KB Output is correct
35 Correct 30 ms 18768 KB Output is correct
36 Correct 30 ms 19024 KB Output is correct
37 Correct 65 ms 19092 KB Output is correct
38 Correct 22 ms 13212 KB Output is correct
39 Correct 21 ms 13144 KB Output is correct