QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#783404#9521. Giving Directions in HarbinZpair#WA 0ms3884kbC++20722b2024-11-26 09:37:172024-11-26 09:37:18

Judging History

你现在查看的是最新测评结果

  • [2024-11-26 09:37:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3884kb
  • [2024-11-26 09:37:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
int calc(char c){
	if(c=='N')return 0;
	if(c=='E')return 1;
	if(c=='S')return 2;
	if(c=='W')return 3;
}
int op[100],v[100],m;
void solve(){
	scanf("%d",&n);
	int lst=0;
	for(int i=1;i<=n;++i){
		char s[10];
		int x;
		scanf("%s%d",s,&x);
		int t=calc(s[0]);
		if(t==lst)
			op[++m]=1,v[m]=x;
		else if((lst+1)%4==t){
			op[++m]=2;
			op[++m]=1,v[m]=x;
		}
		else if((lst+3)%4==t){
			op[++m]=3;
			op[++m]=1,v[m]=x;
		}
		lst=t;
	}
	printf("%d N\n",m);
	for(int i=1;i<=m;++i){
		if(op[i]==1)printf("Z %d\n",v[i]);
		else if(op[i]==2)printf("R\n");
		else printf("L\n");
	}
	m=0;
}
int main(){
	int T;cin>>T;
	while(T--)solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3884kb

input:

1
2
S 2
E 1

output:

2 N
L
Z 1

result:

wrong answer Should start with `Z` (test case 1)