Submission #64088602


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+10;
typedef pair<int,int>PII;
map<PII,bool>st;
int a,b;
int main()
{
int n,r,c;
cin>>n>>r>>c;
getchar();
for(int i=0;i<n;i++)
{
char x;
scanf("%1c",&x);
if(x=='N')
{
st[{a,b}]=true;
a+=-1;
if(st[{a-r,b-c}])
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+10;
typedef pair<int,int>PII;
map<PII,bool>st;
int a,b;
int main()
{
	int n,r,c;
	cin>>n>>r>>c;
	getchar();
	for(int i=0;i<n;i++)
	{
		char x;
		scanf("%1c",&x);
		if(x=='N')
		{
			st[{a,b}]=true;
			a+=-1;
			if(st[{a-r,b-c}])
			{
				cout<<'1';
			}
			else cout<<'0';
			
		}
		else if(x=='S')
		{
			st[{a,b}]=true;
			a+=1;
			if(st[{a-r,b-c}])
			{
				cout<<'1';
			}
			else cout<<'0';
		}
		else if(x=='W')
		{
			st[{a,b}]=true;
			b-=1;
			if(st[{a-r,b-c}])
			{
				cout<<'1';
			}
			else cout<<'0';
	    }
	    else if(x=='E')
	    {
	    	st[{a,b}]=true;
	    	b+=1;
	    	if(st[{a-r,b-c}])
			{
				cout<<'1';
			}
			else cout<<'0';
		}
	}
	
}

Submission Info

Submission Time
Task D - Bonfire
User ZJGLOVE
Language C++ 20 (gcc 12.2)
Score 425
Code Size 781 Byte
Status AC
Exec Time 122 ms
Memory 28832 KB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |                 scanf("%1c",&x);
      |                 ~~~~~^~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 425 / 425
Status
AC × 3
AC × 63
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 3732 KB
sample_02.txt AC 1 ms 3724 KB
sample_03.txt AC 1 ms 3800 KB
test_01.txt AC 39 ms 6652 KB
test_02.txt AC 41 ms 7288 KB
test_03.txt AC 40 ms 7024 KB
test_04.txt AC 1 ms 3640 KB
test_05.txt AC 41 ms 7052 KB
test_06.txt AC 47 ms 9336 KB
test_07.txt AC 43 ms 7480 KB
test_08.txt AC 1 ms 3764 KB
test_09.txt AC 45 ms 8416 KB
test_10.txt AC 43 ms 7084 KB
test_11.txt AC 46 ms 7208 KB
test_12.txt AC 1 ms 3692 KB
test_13.txt AC 47 ms 8964 KB
test_14.txt AC 48 ms 9820 KB
test_15.txt AC 49 ms 10040 KB
test_16.txt AC 2 ms 3804 KB
test_17.txt AC 45 ms 9000 KB
test_18.txt AC 48 ms 9528 KB
test_19.txt AC 46 ms 8972 KB
test_20.txt AC 10 ms 4964 KB
test_21.txt AC 48 ms 9760 KB
test_22.txt AC 45 ms 8336 KB
test_23.txt AC 47 ms 9212 KB
test_24.txt AC 47 ms 9176 KB
test_25.txt AC 120 ms 28736 KB
test_26.txt AC 99 ms 28616 KB
test_27.txt AC 119 ms 28676 KB
test_28.txt AC 101 ms 28572 KB
test_29.txt AC 117 ms 28648 KB
test_30.txt AC 119 ms 28724 KB
test_31.txt AC 115 ms 28596 KB
test_32.txt AC 114 ms 28832 KB
test_33.txt AC 108 ms 28616 KB
test_34.txt AC 94 ms 28576 KB
test_35.txt AC 111 ms 28720 KB
test_36.txt AC 93 ms 28620 KB
test_37.txt AC 117 ms 28644 KB
test_38.txt AC 117 ms 28548 KB
test_39.txt AC 121 ms 28796 KB
test_40.txt AC 122 ms 28740 KB
test_41.txt AC 64 ms 14768 KB
test_42.txt AC 71 ms 23956 KB
test_43.txt AC 71 ms 28432 KB
test_44.txt AC 94 ms 27952 KB
test_45.txt AC 65 ms 17416 KB
test_46.txt AC 64 ms 13652 KB
test_47.txt AC 64 ms 19112 KB
test_48.txt AC 59 ms 15768 KB
test_49.txt AC 72 ms 23984 KB
test_50.txt AC 79 ms 23716 KB
test_51.txt AC 65 ms 18632 KB
test_52.txt AC 68 ms 19136 KB
test_53.txt AC 67 ms 17288 KB
test_54.txt AC 63 ms 27760 KB
test_55.txt AC 76 ms 26740 KB
test_56.txt AC 71 ms 24888 KB
test_57.txt AC 66 ms 24516 KB
test_58.txt AC 62 ms 19964 KB
test_59.txt AC 56 ms 17472 KB
test_60.txt AC 58 ms 19856 KB


2025-04-01 (Tue)
21:58:49 +00:00