QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#704249 | #9521. Giving Directions in Harbin | adivse# | WA | 0ms | 3596kb | C++20 | 2.1kb | 2024-11-02 19:35:59 | 2024-11-02 19:36:00 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#define endl '\n'
#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define rep2(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
template<typename T>
void cc(vector<T> tem) { for (auto x : tem) cout << x << ' '; cout << endl; }
void cc(int a) { cout << a << endl; }
void cc(int a, int b) { cout << a << ' ' << b << endl; }
void cc(int a, int b, int c) { cout << a << ' ' << b << ' ' << c << endl; }
void kuaidu() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); }
inline int max(int a, int b) { if (a < b) return b; return a; }
inline int min(int a, int b) { if (a < b) return a; return b; }
void cmax(int& a, const int b) { if (b > a) a = b; }
void cmin(int& a, const int b) { if (b < a) a = b; }
using PII = pair<int, int>;
using i128 = __int128;
//--------------------------------------------------------------------------------
const int N = 1e5 + 10;
const int M = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 1e16;
int n, m, T;
vector<pair<char, int>> A;
map<char, int> mp;
//--------------------------------------------------------------------------------
signed main() {
kuaidu();
T = 1;
mp['S'] = 2;
mp['E'] = 3;
mp['W'] = 1;
mp['N'] = 0;
cin >> T;
while (T--) {
cin >> n;
rep(i, 1, n) {
char a; int b; cin >> a >> b;
A.push_back({ a,b });
}
int fl = 0;//0 shang 1 zuo 2 xia 3 you
vector<pair<char, int>> B;
for (auto [a, b] : A) {
while (fl != mp[a]) {
fl++;
fl %= 4;
B.push_back({ 'L',0 });
}
B.push_back({ 'Z',b });
}
cout << B.size() << " " << 'N' << endl;
for (auto [a, b] : B) {
if (b == 0) cout << a << endl;
else {
cout << a << " " << b << endl;
}
}
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3596kb
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)