# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315734 | DanerZein | Patkice (COCI20_patkice) | C++14 | 1 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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... |