Submission #386778

#TimeUsernameProblemLanguageResultExecution timeMemory
386778cpp219Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
273 ms159364 KiB
#pragma GCC optimization "Ofast" #pragma GCC optimization "unroll-loop" #pragma GCC target ("avx2") #include <bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second using namespace std; const ll N = 3e3 + 6; const ll Log2 = 19; const ll inf = 1e16 + 7; typedef pair<ll,ll> LL; ll n,m,cntO[N][N],cntI[N][N]; char a[N][N]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); #define task "tst" if (fopen(task".inp", "r")){ freopen(task".inp", "r", stdin); //freopen(task".out", "w", stdout); } cin>>n>>m; for (ll i = 1;i <= n;i++){ for (ll j = 1;j <= m;j++){ cin>>a[i][j]; cntI[i][j] = cntI[i - 1][j] + (a[i][j] == 'I'); cntO[i][j] = cntO[i][j - 1] + (a[i][j] == 'O'); } } ll ans = 0; for (ll i = 1;i <= n;i++){ for (ll j = 1;j <= m;j++) if (a[i][j] == 'J'){ ll p = cntO[i][m] - cntO[i][j - 1],q = cntI[n][j] - cntI[i - 1][j]; ans += p*q; } } cout<<ans; }

Compilation message (stderr)

joi2019_ho_t1.cpp:1: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    1 | #pragma GCC optimization "Ofast"
      | 
joi2019_ho_t1.cpp:2: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    2 | #pragma GCC optimization "unroll-loop"
      | 
joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   23 |         freopen(task".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...