# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580847 | 2022-06-22T01:52:04 Z | Metal_Sonic | Bitaro the Brave (JOI19_ho_t1) | C++17 | 1 ms | 340 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define sz(x) (int)(x).size() #define all(x) x.begin() , x.end() void setIO(string name = "") { ios_base::sync_with_stdio(false); cin.tie(nullptr); if(sz(name)){ freopen((name+".in").c_str(), "r", stdin); freopen((name+".out").c_str(), "w", stdout); } } const int N = 3005; int I[N] , O[N]; vector<vector<int>>J(N); void run_test_case(){ int n , m;cin>>n>>m; for(int i = 0; i < n; i++){ string s;cin>>s; bool found = false; for(int j = m-1; j >= 0; j--){ if(s[j] == 'I')I[j]++; else if(s[j] == 'O')O[i]++,found=true; else if(found) J[i].push_back(j); } } int ans = 0; for(int i = 0; i < n; i++){ for(auto it : J[i]){ ans+=O[i]*I[it]; } } cout<<ans; } int main() { setIO(); int T = 1; while(T--){ run_test_case(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Incorrect | 1 ms | 340 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Incorrect | 1 ms | 340 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Incorrect | 1 ms | 340 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |