답안 #641715

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
641715 2022-09-17T13:29:55 Z Vladth11 Chess Rush (CEOI20_chessrush) C++14
15 / 100
1716 ms 16896 KB
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "

using namespace std;
typedef long long ll;
typedef pair <int, int> pii;

const int NMAX = 100001;
const int VMAX = 101;
const int INF = 2e9;
const int MOD = 1000000007;
const int BLOCK = 447;
const int base = 117;
const int nr_of_bits = 24;
const int inv2 = 500000004;

int dx[] = {1, -1, 1, -1};
int dy[] = {1, -1, -1, 1};

int R, C;

bool OK(int i, int j) {
    if(i < 1 || j < 1 || i > R || j > C)
        return 0;
    return 1;
}

void add(int &x, int val) {
    x = (1LL * x + 1LL * val) % MOD;
}

pii cnt[101][101][101];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int q;
    cin >> R >> C >> q;
    for(int i = 1; i <= C; i++) {
        queue <pii> q;
        q.push({1, i});
        cnt[i][1][i] = {0, 1};
        while(q.size()) {
            pii x = q.front();
            q.pop();
            for(int d = 0; d < 4; d++) {
                int ni = x.first + dx[d];
                int nj = x.second + dy[d];
                while(OK(ni, nj)) {
                    if(cnt[i][ni][nj].second == 0) {
                        q.push({ni, nj});
                        cnt[i][ni][nj] = cnt[i][x.first][x.second];
                        add(cnt[i][ni][nj].first, 1);
                    } else if(cnt[i][ni][nj].first == cnt[i][x.first][x.second].first + 1) {
                        add(cnt[i][ni][nj].second, cnt[i][x.first][x.second].second);
                    }
                    ni = ni + dx[d];
                    nj = nj + dy[d]; /// grija sa nu pun int inainte....
                }
            }
        }
    }
    while(q--) {
        int c1, cR;
        char T;
        cin >> T;
        cin >> c1 >> cR;
        cout << cnt[c1][R][cR].first << " " << cnt[c1][R][cR].second << "\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 1108 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 1108 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 3 ms 1492 KB Output is correct
5 Runtime error 1716 ms 16896 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 2772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 2772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 2772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 2772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -