QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#683070 | #9531. Weird Ceiling | utada# | WA | 1ms | 3612kb | C++17 | 1.0kb | 2024-10-27 18:38:42 | 2024-10-27 18:38:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
signed main()
{
int t;
cin>>t;
map <char,int> mp;
mp['E']=0; mp['W']=2; mp['N']=1; mp['S']=3;
while(t--){
int m;
cin>>m;
int idx=0;
char d,in;
string kl[300];
int su[300];
for(int i=0;i<=40;i++) su[i]=0;
for(int i=0;i<m;i++){
char c;
int a;
cin>>c>>a;
if(i==0) {
d=c;
in=c;
kl[idx]="Z";
su[idx]=a;
idx++;
continue;
}
int op=mp[in]; int ed=mp[c];
if(abs(op-ed)==2){
kl[idx]="L";
idx++;
kl[idx]="L";
idx++;
su[idx]=a;
kl[idx]="Z";
idx++;
in=c;
continue;
}
if((op-ed)>0) {
if(op-ed==3) kl[idx]="L";
else kl[idx]="R";
idx++;
}
else {
if(op-ed==-3) kl[idx]="R";
else kl[idx]="L";
idx++;
}
su[idx]=a;
kl[idx]="Z";
idx++;
in=c;
}
cout<<idx<<' '<<d<<endl;
for(int i=0;i<idx;i++){
cout<<kl[i];
if(su[i]) cout<<' '<<su[i];
cout<<endl;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3612kb
input:
3 5 451 114514
output:
9 4 Z 51 L Z 14514 L Z 14514 L Z 14514 L Z 14514 9 4 Z 14368 L Z 14368 L Z 14368 L Z 14368 L Z 14368 9 4 Z 14368 L Z 14368 L Z 14368 L Z 14368 L Z 14368
result:
wrong answer 1st lines differ - expected: '21', found: '9 4'