Submission #724848

#TimeUsernameProblemLanguageResultExecution timeMemory
724848guagua0407Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
212 ms17920 KiB
//#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } int main() {_ int n,m; cin>>n>>m; char num[n][m]; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>num[i][j]; } } vector<int> cnt2(m,0); for(int j=0;j<m;j++){ for(int i=0;i<n;i++){ if(num[i][j]=='I') cnt2[j]++; } } ll ans=0; for(int i=0;i<n;i++){ int cnt=0; for(int j=m-1;j>=0;j--){ if(num[i][j]=='I') cnt2[j]--; if(num[i][j]=='O') cnt++; if(num[i][j]=='J'){ ans+=cnt*cnt2[j]; } } } cout<<ans; return 0; } //maybe its multiset not set

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'void setIO(std::string)':
joi2019_ho_t1.cpp:12:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:13:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...