답안 #549536

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
549536 2022-04-16T02:50:37 Z Soul234 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
95 ms 19096 KB
#include<bits/stdc++.h>
using namespace std;

void DBG() { cerr << "]\n"; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << h; if(sizeof...(t)) cerr << ", ";
    DBG(t...);
}
#ifdef LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif // LOCAL

#define FOR(i,a,b) for(int i = (a) ; i<(b) ; i++)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for(int i = (b)-1 ; i>=(a) ; i--)
#define R0F(i,a) ROF(i,0,a)
#define each(e,a) for(auto &e : (a))
#define sz(v) (int)(v).size()
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb push_back
#define tcT template<class T
#define nl "\n"

using ll = long long;
using vi = vector<int>;
using pi = pair<int,int>;
using str = string;
tcT> using V = vector<T>;
tcT> using pqg = priority_queue<T,vector<T>,greater<T>>;

void setIO(string NAME = "") {
    cin.tie(0)->sync_with_stdio(0);
    if(sz(NAME)) {
        freopen((NAME + ".inp").c_str(),"r",stdin);
        freopen((NAME + ".out").c_str(),"w",stdout);
    }
}

const int MX = 3e3+5;
int cntI[MX], cntO[MX], W, H;
str s[MX];
ll ans = 0;

void solve() {
    cin>>H>>W;
    F0R(i,H) cin>>s[i];
    R0F(i,H) R0F(j,W) {
        if(s[i][j] == 'J') ans += 1LL*cntI[j]*cntO[i];
        else if(s[i][j] == 'O') cntO[i]++;
        else cntI[j]++;
    }
    cout << ans << nl;
}

int main() {
    setIO();

    int t=1;
    //cin>>t;
    while(t-->0) {
        solve();
    }

    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'void setIO(std::string)':
joi2019_ho_t1.cpp:37:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |         freopen((NAME + ".inp").c_str(),"r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:38:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |         freopen((NAME + ".out").c_str(),"w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 428 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 428 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 428 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 428 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 424 KB Output is correct
14 Correct 3 ms 724 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 596 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 3 ms 940 KB Output is correct
19 Correct 2 ms 888 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 3 ms 852 KB Output is correct
22 Correct 2 ms 812 KB Output is correct
23 Correct 2 ms 852 KB Output is correct
24 Correct 3 ms 944 KB Output is correct
25 Correct 3 ms 852 KB Output is correct
26 Correct 2 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 428 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 428 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 424 KB Output is correct
14 Correct 3 ms 724 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 596 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 3 ms 940 KB Output is correct
19 Correct 2 ms 888 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 3 ms 852 KB Output is correct
22 Correct 2 ms 812 KB Output is correct
23 Correct 2 ms 852 KB Output is correct
24 Correct 3 ms 944 KB Output is correct
25 Correct 3 ms 852 KB Output is correct
26 Correct 2 ms 852 KB Output is correct
27 Correct 95 ms 17944 KB Output is correct
28 Correct 1 ms 468 KB Output is correct
29 Correct 3 ms 1724 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 60 ms 13184 KB Output is correct
32 Correct 43 ms 18844 KB Output is correct
33 Correct 39 ms 18784 KB Output is correct
34 Correct 68 ms 15200 KB Output is correct
35 Correct 37 ms 18668 KB Output is correct
36 Correct 39 ms 18876 KB Output is correct
37 Correct 88 ms 19096 KB Output is correct
38 Correct 30 ms 13092 KB Output is correct
39 Correct 27 ms 13032 KB Output is correct