QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#783403#9521. Giving Directions in HarbinZpair#WA 0ms3904kbC++20725b2024-11-26 09:36:372024-11-26 09:36:38

Judging History

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

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

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 %d\n",m,0);
	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: 3904kb

input:

1
2
S 2
E 1

output:

2 0
L
Z 1

result:

wrong answer Token parameter [name=f] equals to "0", doesn't correspond to pattern "[NSWE]" (test case 1)