Submission #464861

#TimeUsernameProblemLanguageResultExecution timeMemory
464861jamezzzBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
754 ms17904 KiB
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #include <ext/rope> using namespace __gnu_cxx; typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds; //less_equal for identical elements #ifdef DEBUG #define dbg(...) printf(__VA_ARGS__); #else #define dbg(...) #endif #define sf scanf #define pf printf #define fi first #define se second #define pb emplace_back #define sz(x) (int)x.size() #define mnto(x,y) x=min(x,(__typeof__(x))y) #define mxto(x,y) x=max(x,(__typeof__(x))y) #define INF 1023456789 #define LINF 1023456789123456789 #define all(x) x.begin(), x.end() typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef pair<ll, ll> pll; typedef tuple<int, int, int> iii; typedef tuple<int, int, int, int> iiii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<pll> vll; mt19937 rng(time(0)); int h,w,o[3005]; char c[3005][3005]; int main(){ sf("%d%d",&h,&w); for(int i=0;i<h;++i){ for(int j=0;j<w;++j){ sf(" %c",&c[i][j]); } } ll ans=0; for(int j=w-1;j>=0;--j){ int cnt=0; for(int i=h-1;i>=0;--i){ if(c[i][j]=='J')ans+=cnt*o[i]; if(c[i][j]=='O')++o[i]; if(c[i][j]=='I')++cnt; } } pf("%lld\n",ans); }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:44:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |  sf("%d%d",&h,&w);
      |    ^
joi2019_ho_t1.cpp:47:6: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |    sf(" %c",&c[i][j]);
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...