# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
315734 | DanerZein | Patkice (COCI20_patkice) | C++14 | 1 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,char> ci;
vector<string> vs;
const ll MAX=1e9;
ll n,m;
ll voyage(ll a,ll b){
if(a<0 or b<0 or a>=n or b>=m) return MAX;
ll ans=0;
if(vs[a][b]=='.' or vs[a][b]=='o') return MAX;
if(vs[a][b]=='x') return 0;
if(vs[a][b]=='>')
ans+=(voyage(a,b+1)+1);
if(vs[a][b]=='<')
ans+=(voyage(a,b-1)+1);
if(vs[a][b]=='^')
ans+=(voyage(a-1,b)+1);
if(vs[a][b]=='v')
ans+=(voyage(a+1,b)+1);
return ans;
}
int main(){
cin>>n>>m;
ll a,b;
a=-1; b=-1;
for(ll i=0;i<n;i++){
string x;
cin>>x;
vs.push_back(x);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |