File tree 4 files changed +60
-0
lines changed
4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ 5 6 W
Original file line number Diff line number Diff line change
1
+ 1
2
+
3
+ 7 8
4
+ ********
5
+ * * * **
6
+ * * *
7
+ * * ** *
8
+ * * * *
9
+ * * **
10
+ ********
11
+ 2 4
12
+ RRFLFF FFR
13
+ FF
14
+ RFFQ
Original file line number Diff line number Diff line change
1
+ // https://uva.onlinejudge.org/external/103/10377.pdf
2
+ #include < bits/stdc++.h>
3
+ using namespace std ;
4
+ using vs=vector<string>;
5
+ int main (){
6
+ ios::sync_with_stdio (0 );
7
+ cin.tie (0 );
8
+ int t,n,m,y,x,o,q;
9
+ int dy[]={-1 ,0 ,1 ,0 };
10
+ int dx[]={0 ,1 ,0 ,-1 };
11
+ cin>>t;
12
+ for (int T=0 ;T<t;T++){
13
+ cin>>n>>m;
14
+ string s;
15
+ getline (cin,s);
16
+ vs a (n);
17
+ for (int i=0 ;i<n;i++){
18
+ getline (cin,s);
19
+ a[i]=s;
20
+ }
21
+ cin>>y>>x;
22
+ getline (cin,s);
23
+ y--;x--;
24
+ o=0 ;q=0 ;
25
+ for (;;){
26
+ getline (cin,s);
27
+ for (char c:s){
28
+ if (c==' L' )o=!o?3 :o-1 ;
29
+ else if (c==' R' )o=o==3 ?0 :o+1 ;
30
+ else if (c==' F' ){
31
+ if (a[y+dy[o]][x+dx[o]]!=' *' ){y+=dy[o];x+=dx[o];}
32
+ }else if (c==' Q' ){q=1 ;break ;}
33
+ }
34
+ if (q)break ;
35
+ }
36
+ for (;;){
37
+ getline (cin,s);
38
+ if (s.empty ())break ;
39
+ }
40
+ if (T)cout<<" \n " ;
41
+ cout<<y+1 <<" " <<x+1 <<" " <<" NESW" [o]<<" \n " ;
42
+ }
43
+ }
Original file line number Diff line number Diff line change @@ -111,6 +111,8 @@ There are solutions for the following
111
111
([ problem site] ( https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1277 ) )
112
112
1 . [ 10369 - Arctic Network] ( 10369.cc )
113
113
([ problem site] ( https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1310 ) )
114
+ 1 . [ 10377 - Maze Traversal] ( 10377.cc )
115
+ ([ problem site] ( https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1318 ) )
114
116
1 . [ 10382 - Watering Grass] ( 10382.cc )
115
117
([ problem site] ( https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1323 ) )
116
118
1 . [ 10507 - Waking up brain] ( 10507.cc )
You can’t perform that action at this time.
0 commit comments