Submission #162373

#TimeUsernameProblemLanguageResultExecution timeMemory
162373godwindBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
471 ms159224 KiB
#include <iostream> #include <algorithm> #include <vector> #include <cmath> #include <cstdio> #include <string> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <bitset> #include <random> #include <ctime> #include <utility> #include <fstream> #include <queue> #include <deque> #pragma GCC optimize("Ofast") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("fast-math") #pragma GCC optimize("vpt") #pragma GCC optimize("unroll-loops") #pragma comment(linker, "/STACK:256000000") #pragma warning(disable:4996) using namespace std; typedef long long ll; typedef long double ld; const ld pi = 3.14159265358979323846264; const char el = '\n'; //const int inf = 1000'000'000; const ll llinf = 1e18, mod = 1000'000'007; #define forn(i, n) for (int i = 0; i < (int)n; ++i) #define firn(i, n) for (int i = 1; i < (int)n; ++i) #define all(v) v.begin(), v.end() #define x first #define y second template<typename T> bool uin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; } template<typename T> bool uax(T &a, T b) { if (b > a) { a = b; return 1; } return 0; } template<class iterator> void output(iterator begin, iterator end, char p = ' ', ostream &out = cout) { while (begin != end) { out << (*begin) << p; begin++; } out << el; } template<class T> void output(T x, char p = ' ', ostream &out = cout) { output(all(x), p, out); } mt19937 rnd(time(NULL)); #define int long long const int N = 3005; char a[N][N]; int O[N][N]; int I[N][N]; signed main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n, m; cin >> n >> m; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { cin >> a[i][j]; if (a[i][j] == 'O') { O[i][j] = 1; } if (a[i][j] == 'I') { I[i][j] = 1; } } } for (int i = 1; i <= n; ++i) { for (int j = m; j; --j) { O[i][j] = O[i][j] + O[i][j + 1]; } } for (int j = 1; j <= m; ++j) { for (int i = n; i; --i) { I[i][j] = I[i][j] + I[i + 1][j]; } } long long res = 0; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { if (a[i][j] == 'J') { res += O[i][j] * I[i][j]; } } } cout << res << '\n'; return 0; } /* <>>><<><<<<<>>>< 0 3 2 1 0 1 2 0 1 2 3 4 5 2 1 0 1 0 3 2 1 0 1 2 0 1 2 3 4 5 3 2 0 1 */

Compilation message (stderr)

joi2019_ho_t1.cpp:24:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/STACK:256000000")
 
joi2019_ho_t1.cpp:25:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(disable:4996)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...