# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
88656 | Badral | 힘 센 거북 (IZhO11_turtle) | C++17 | 831 ms | 262148 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define maxn 10005
#define mp make_pair
using namespace std;
typedef long long ll;
bool a[maxn][maxn];
int main() {
int n, m, k1, t, z;
cin >>n >>m >>k1 >>t >>z;
while(k1--) {
int x, y;
cin >>x >>y;
a[x][y] = 1;
}
ll ans = 0;
queue<pair<pair<int,int> ,int> > pq;
pq.push(mp(mp(0, 0), t));
while(!pq.empty()) {
int x = pq.front().first.first;
int y = pq.front().first.second;
int k = pq.front().second;
if(x == n && y == m) ans++;
if(x < n) {
if(a[x+1][y] == 1 && k > 0) {
pq.push(mp(mp(x+1, y), k-1));
}
if(a[x+1][y] == 0) {
pq.push(mp(mp(x+1, y), k));
}
}
if(y < m) {
if(a[x][y+1] == 1 && k > 0) {
pq.push(mp(mp(x, y+1), k-1));
}
if(a[x][y+1] == 0) {
pq.push(mp(mp(x, y+1), k));
}
}
pq.pop();
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |