제출 #896539

#제출 시각아이디문제언어결과실행 시간메모리
896539MinbaevBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
355 ms159056 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pii pair<int,int> using namespace __gnu_pbds; using namespace std; #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define int long long #define f first #define s second #define pii pair<int,int> template<class T>bool umax(T &a,T b){if(a<b){a=b;return true;}return false;} template<class T>bool umin(T &a,T b){if(b<a){a=b;return true;}return false;} typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; const int mod= 1e9 +7; const int N=1e5*4; int binpow (int a, int n) { if (n == 0) return 1; if (n % 2 == 1) return binpow (a, n-1) * a; else { int b = binpow (a, n/2); return b * b; } } void solve(){ int n,m,k,q; cin>>n>>m; char arr[n+1][m+1]; for(int i = 1;i<=n;i++){ for(int j = 1;j<=m;j++){ cin>>arr[i][j]; } } int pref[n+2][m+2]; int suff[n+2][m+2]; memset(pref,0ll,sizeof(pref)); memset(suff,0ll,sizeof(suff)); for(int i = 1;i<=n;i++){ for(int j = m;j>=1;j--){ pref[i][j] = pref[i][j+1]; if(arr[i][j]=='O')pref[i][j]++; } } for(int j = 1;j<=m;j++){ for(int i = n;i>=1;i--){ suff[i][j] = suff[i+1][j]; if(arr[i][j]=='I')suff[i][j]++; } } int ans = 0; for(int i = 1;i<=n;i++){ for(int j = 1;j<=m;j++){ if(arr[i][j]=='J') ans += (pref[i][j]*suff[i][j]); } } cout<<ans<<"\n"; } signed main() { // freopen("seq.in", "r", stdin); // freopen("seq.out", "w", stdout); ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); int tt=1;//cin>>tt; while(tt--)solve(); }

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

joi2019_ho_t1.cpp: In function 'void solve()':
joi2019_ho_t1.cpp:33:10: warning: unused variable 'k' [-Wunused-variable]
   33 |  int n,m,k,q;
      |          ^
joi2019_ho_t1.cpp:33:12: warning: unused variable 'q' [-Wunused-variable]
   33 |  int n,m,k,q;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...