제출 #1254471

#제출 시각아이디문제언어결과실행 시간메모리
1254471hoa208Bitaro the Brave (JOI19_ho_t1)C++20
50 / 100
230 ms339968 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++) #define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; i--) #define pa pair<ll, ll> #define fi first #define se second #define bit(mask, j) ((mask >> j) & 1) #define t_test int t;cin >> t;while(t--) const ll mod = 1e9 + 7; const ll INF = 1e18; inline void adm(ll &x){if(x>=mod)x%=mod;else if(x<0)x+=mod;} //-------------------------------------------------------------------- string T = "JOI"; ll n, m; const ll N = 5003; ll s[N][N][4], c[N][N]; ll get(ll u, ll v, ll x, ll y, ll t) { return s[x][y][t] - s[u - 1][y][t] - s[x][v - 1][t] + s[u - 1][v - 1][t]; } void hbmt() { cin >> n >> m; FOR(i, 1, n) { FOR(j, 1, m) { char x; cin >> x; ll e = T.find(x); c[i][j] = e; FOR(u, 0, 2) { s[i][j][u] = s[i - 1][j][u] + s[i][j - 1][u] - s[i - 1][j - 1][u] + (e == u); } } } ll ans = 0; FOR(i, 1, n) { FOR(j, 1, m) { if(c[i][j] == 0) { ans += 1LL * get(i, j, i, m, 1) * get(i, j, n, j, 2); } } } cout << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); if(fopen("hbmt.inp", "r")) { freopen("hbmt.inp", "r", stdin); freopen("hbmt.out", "w", stdout); } // t_test hbmt(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:53:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |         freopen("hbmt.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:54:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |         freopen("hbmt.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...