Submission #914801

#TimeUsernameProblemLanguageResultExecution timeMemory
914801vjudge1Patkice (COCI20_patkice)C++11
50 / 50
1 ms600 KiB
#include <bits/stdc++.h> /*#include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds;*/ using namespace std; /*typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; #define MOD 1000000007 #define F first #define S second #define PB push_back #define MP make_pair #define FIN "\n" #define REP(i,a,b) for(int i=a;i<b;i++) #define ALL(x) x.begin(),x.end(); typedef long long int ll; typedef long double ld; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int,int> pii;*/ int r,s,posi=0,posj=0; int main() { ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); //scanf("%d %d",&r,&s); cin >> r >> s; char corr[r][s]; /*scanf("%c",&auxi);*/ for(int i=0;i<r;i++){ for(int j=0;j<s;j++){ //scanf("%c",&corr[i][j]); cin >> corr[i][j]; if(corr[i][j]=='o'){ posi=i; posj=j; } } } int i=posi,j=posj+1,mini=1e6,con=0; bool xd=false; char res='.'; while(true){ con++; if(corr[i][j]=='^'){ i--; }else if(corr[i][j]=='v'){ i++; }else if(corr[i][j]=='<'){ j--; }else if(corr[i][j]=='>'){ j++; }else if(corr[i][j]=='x'){ xd=true; break; }else{ break; } } if(xd){ res='E'; mini=con; } i=posi-1,j=posj,con=0,xd=false; while(true){ con++; if(corr[i][j]=='^'){ i--; }else if(corr[i][j]=='v'){ i++; }else if(corr[i][j]=='<'){ j--; }else if(corr[i][j]=='>'){ j++; }else if(corr[i][j]=='x'){ xd=true; break; }else{ break; } } if(xd){ if(con<mini){ mini=con; res='N'; } } i=posi+1,j=posj,con=0,xd=false; while(true){ con++; if(corr[i][j]=='^'){ i--; }else if(corr[i][j]=='v'){ i++; }else if(corr[i][j]=='<'){ j--; }else if(corr[i][j]=='>'){ j++; }else if(corr[i][j]=='x'){ xd=true; break; }else{ break; } } if(xd){ if(con<mini){ mini=con; res='S'; } } i=posi,j=posj-1,con=0,xd=false; while(true){ con++; if(corr[i][j]=='^'){ i--; }else if(corr[i][j]=='v'){ i++; }else if(corr[i][j]=='<'){ j--; }else if(corr[i][j]=='>'){ j++; }else if(corr[i][j]=='x'){ xd=true; break; }else{ break; } } if(xd){ if(con<mini){ mini=con; res='W'; } } if(res!='.'){ cout << ":)\n" << res; //printf(":)\n"); //printf("%c",res); }else{ cout << ":("; //printf(":("); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...