CSES - Leirikisa 2 - Results
Submission details
Task:Nautilus
Sender:a256
Submission time:2023-04-18 17:31:16 +0300
Language:C++ (C++11)
Status:READY
Result:29
Feedback
groupverdictscore
#1ACCEPTED29
#20
#30
Test results
testverdicttimegroup
#10.01 s2, 3details
#2ACCEPTED0.01 s1, 2, 3details
#3ACCEPTED0.01 s1, 2, 3details
#4ACCEPTED0.01 s1, 2, 3details
#5ACCEPTED0.01 s1, 2, 3details
#6ACCEPTED0.01 s1, 2, 3details
#7ACCEPTED0.01 s1, 2, 3details
#80.01 s2, 3details
#90.01 s2, 3details
#100.01 s2, 3details
#110.01 s2, 3details
#120.01 s2, 3details
#130.01 s2, 3details
#140.01 s2, 3details
#150.01 s2, 3details
#160.01 s2, 3details
#170.01 s2, 3details
#18ACCEPTED0.01 s2, 3details
#190.01 s2, 3details
#200.01 s2, 3details
#210.01 s2, 3details
#22ACCEPTED0.01 s2, 3details
#23--3details
#240.02 s3details
#250.01 s3details
#260.01 s3details
#270.01 s3details
#28--3details
#290.04 s3details
#300.02 s3details
#310.01 s3details
#320.01 s3details
#33--3details
#34--3details
#35--3details
#360.60 s3details
#37ACCEPTED0.03 s3details

Code

#include <bits/stdc++.h>
using namespace std;

int R,C,M,r;
string s[100000],t;

int käykö(int y,int x){
	if(s[y][x]=='#') return false;
	for(int c:t){
		switch(c){
		case 'N':
			--y;
			break;
		case 'S':
			++y;
			break;
		case 'W':
			--x;
			break;
		case 'E':
			++x;
			break;
		}
		if(x<0||x>=C) return false;
		if(y<0||y>=R) return false;
		if(s[y][x]=='#') return false;
	}
	return true;
}

int main(){
	cin>>R>>C>>M;
	for(int i=0;i<R;++i){
		cin>>s[i];
	}
	cin>>t;
	for(int y=0;y<R;++y){
		for(int x=0;x<C;++x){
			bool k=käykö(y,x);
			r+=k;
		}
	}
	cout<<r<<'\n';
}

Test details

Test 1

Group: 2, 3

Verdict:

input
5 9 7
...##....
..#.##..#
..#....##
.##...#..
...

correct output
22

user output
1

Test 2

Group: 1, 2, 3

Verdict: ACCEPTED

input
100 100 100
.................................

correct output
8272

user output
8272

Test 3

Group: 1, 2, 3

Verdict: ACCEPTED

input
100 100 100
.#...#.#..#.....#.........#......

correct output
5

user output
5

Test 4

Group: 1, 2, 3

Verdict: ACCEPTED

input
100 100 100
.#...##...#...##....##.#.##..#...

correct output
1

user output
1

Test 5

Group: 1, 2, 3

Verdict: ACCEPTED

input
100 100 100
..#.#.#..###.#.#.##..########....

correct output
1

user output
1

Test 6

Group: 1, 2, 3

Verdict: ACCEPTED

input
100 100 100
.#.#.###########..#.###.######...

correct output
1

user output
1

Test 7

Group: 1, 2, 3

Verdict: ACCEPTED

input
100 100 100
##############################...

correct output
1

user output
1

Test 8

Group: 2, 3

Verdict:

input
100 100 100
.................................

correct output
9503

user output
8277

Test 9

Group: 2, 3

Verdict:

input
100 100 100
#..#.##..#....##...#.##.##..#....

correct output
495

user output
1

Test 10

Group: 2, 3

Verdict:

input
100 100 100
#.#...######.#####.#.##...#.##...

correct output
51

user output
0

Test 11

Group: 2, 3

Verdict:

input
100 100 100
.#.#.###########..#.###.######...

correct output
34

user output
0

Test 12

Group: 2, 3

Verdict:

input
100 100 100
##############################...

correct output
19

user output
0

Test 13

Group: 2, 3

Verdict:

input
100 100 100
.................................

correct output
9801

user output
8835

Test 14

Group: 2, 3

Verdict:

input
100 100 100
..............#..................

correct output
7479

user output
65

Test 15

Group: 2, 3

Verdict:

input
100 100 100
#.#.........###.#..#.#..####.#...

correct output
5328

user output
0

Test 16

Group: 2, 3

Verdict:

input
100 100 100
.#.#.###########..#.###.######...

correct output
127

user output
8

Test 17

Group: 2, 3

Verdict:

input
100 100 100
##############################...

correct output
19

user output
0

Test 18

Group: 2, 3

Verdict: ACCEPTED

input
100 100 100
.................................

correct output
10000

user output
10000

Test 19

Group: 2, 3

Verdict:

input
100 100 100
..............#..................

correct output
8047

user output
8063

Test 20

Group: 2, 3

Verdict:

input
100 100 100
#.#...######.#####.#.##...#.##...

correct output
3500

user output
4062

Test 21

Group: 2, 3

Verdict:

input
100 100 100
.#.#.###########..#.###.######...

correct output
1228

user output
2054

Test 22

Group: 2, 3

Verdict: ACCEPTED

input
100 100 100
##############################...

correct output
43

user output
43

Test 23

Group: 3

Verdict:

input
500 500 5000
.................................

correct output
249493

user output
(empty)

Test 24

Group: 3

Verdict:

input
500 500 5000
#..#.##..#....##...#.##.##..#....

correct output
222

user output
0

Test 25

Group: 3

Verdict:

input
500 500 5000
.#####....####..###...####.#.#...

correct output
1268

user output
0

Test 26

Group: 3

Verdict:

input
500 500 5000
#.#####.##..#####.####..######...

correct output
805

user output
0

Test 27

Group: 3

Verdict:

input
500 500 5000
##############################...

correct output
349

user output
0

Test 28

Group: 3

Verdict:

input
500 500 5000
.................................

correct output
249999

user output
(empty)

Test 29

Group: 3

Verdict:

input
500 500 5000
..............#..................

correct output
197917

user output
0

Test 30

Group: 3

Verdict:

input
500 500 5000
#.#.........###.#..#.#..####.#...

correct output
79550

user output
0

Test 31

Group: 3

Verdict:

input
500 500 5000
#.#####.##..#####.####..######...

correct output
1221

user output
0

Test 32

Group: 3

Verdict:

input
500 500 5000
##############################...

correct output
1414

user output
0

Test 33

Group: 3

Verdict:

input
500 500 5000
.................................

correct output
250000

user output
(empty)

Test 34

Group: 3

Verdict:

input
500 500 5000
..............#..................

correct output
199752

user output
(empty)

Test 35

Group: 3

Verdict:

input
500 500 5000
.#####....####..###...####.#.#...

correct output
87691

user output
(empty)

Test 36

Group: 3

Verdict:

input
500 500 5000
#.#####.##..#####.####..######...

correct output
30998

user output
51349

Test 37

Group: 3

Verdict: ACCEPTED

input
500 500 5000
##############################...

correct output
1440

user output
1440