Submission #1271766

#TimeUsernameProblemLanguageResultExecution timeMemory
1271766cbnk32_tuandungEmacs (COCI20_emacs)C++17
50 / 50
1 ms328 KiB
/*  _  _   ___   __  ___  ___  _  _  ___  __   ___     _   _  ___   ___  __   _____  _  _  ___       */
/* | || | /_\ \ / / / __|/ _ \| \| |/ __| \ \ / /_\   | | | |/ _ \ / __| \ \ / / _ \| \| |/ __|      */
/* | __ |/ _ \ V /  \__ \ (_) | .` | (_ |  \ V / _ \  | |_| | (_) | (__   \ V / (_) | .` | (_ |      */
/* |_||_/_/_\_\_|___|___/\___/|_|\_|\___|   \_/_/_\_\ _\___/ \___/ \___| _ \_/_\___/|_|\_|\___| ___  */
/* |   \| __| |_   _| || | /_\ \ / / |   \ / _ \_ _| |  \/  | __| \| | || | |  \/  |/ _ \| \| |/ __| */
/* | |) | _|    | | | __ |/ _ \ V /  | |) | (_) | |  | |\/| | _|| .` | __ | | |\/| | (_) | .` | (_ | */
/* |___/|___|   |_| |_||_/_/ \_\_|   |___/ \___/___| |_|  |_|___|_|\_|_||_| |_|  |_|\___/|_|\_|\___| */

#include <bits/stdc++.h>
using namespace std;

/*
 
 run
 g++ coci1920_r5_emacs.cpp -o run.exe && ./run.exe
 g++ coci1920_r5_emacs.cpp -std=c++1y -o run.exe && ./run.exe
 
 */

#define re exit(0)
#define r0 return 0
#define ll long long
#define ull unsigned long long
#define TASK "."

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

constexpr int MOD = 1000000007;
constexpr int MAX_N = 100 + 5;

template<typename T> void minimise(T &abc, T xyz) {
    if (abc > xyz) abc = xyz;
}

template<typename T> void maximise(T &abc, T xyz) {
    if (abc < xyz) abc = xyz;
}

template<typename T> void add(T &abc, T xyz) {
    abc += xyz;
    if (abc >= MOD) abc -= MOD;
    if (abc < 0) abc += MOD;
}

void fileIO() {
    freopen(TASK".INP", "r", stdin);
    freopen(TASK".OUT", "w", stdout);
}

int M, N;
char c;
bool A[MAX_N][MAX_N];

int dp[MAX_N][MAX_N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    // fileIO();

    cin >> M >> N;
    for (int i = 1; i <= M; ++i) {
        for (int j = 1; j <= N; ++j) {
            cin >> c;
            A[i][j] = (c == '*');
        }
    }

    for (int i = 1; i <= M; ++i) {
        for (int j = 1; j <= N; ++j) {
            // cout << A[i][j];
            dp[i][j] = dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1];
            if (A[i][j]) {
                if (!(A[i - 1][j] || A[i][j - 1] || A[i - 1][j - 1])) ++dp[i][j];
            }
            // cout << dp[i][j] << " ";
        }
        // cout << endl;
    }

    cout << dp[M][N];
    
    cerr << "\nTime elapsed: " << (1.0 * clock() / CLOCKS_PER_SEC) << " s.";
    r0;
}

/*
 Rubi-channnnn~~~
 Haiiii~~~
 Nani ga suki?
 Choco minto... yori mo anata~
 
 Ayumu-channnnn~~~
 Haiiiii~~~
 Nani ga suki?
 Suturuberi fureiba yori mo anata~
 
 Shiki-channnn~~~
 Haiiiii~~~~
 Nani ga suki?
 Kukkie ando krimu yori mo anata~
 
 Minaaaa~~~
 Haiiiiii~~~
 Nani ga suki?
 Mochrion daisuki AI♡SCREAM
*/

Compilation message (stderr)

emacs.cpp: In function 'void fileIO()':
emacs.cpp:48:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |     freopen(TASK".INP", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
emacs.cpp:49:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |     freopen(TASK".OUT", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...