QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#708836#9521. Giving Directions in Harbinqzez#WA 0ms4076kbC++14582b2024-11-04 08:27:102024-11-04 08:27:10

Judging History

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

  • [2024-11-04 08:27:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4076kb
  • [2024-11-04 08:27:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int T,n;
char dir[5]="NWSE";
int trans(char c){
	return find(dir,dir+4,c)-dir;
}
void work(){
	scanf("%d",&n);
	int cur=0;
	vector<pair<char,int>>ans;
	for(;n--;){
		char str[9];
		int x;
		scanf("%s%d",str,&x);
		int p=trans(*str);
		for(;cur!=p;)ans.push_back({'L',0}),(cur+=1)%=4;
		ans.push_back({'Z',x});
	}
	printf("%ld N\n",ans.size());
	for(auto [x,y]:ans){
		if(x=='Z')printf("%c %d\n",x,y);
		else printf("%c\n",x);
	}
}
int main(){
	for(scanf("%d",&T);T--;)work();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
2
S 2
E 1

output:

5 N
L
L
Z 2
L
Z 1

result:

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