QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#817896 | #9521. Giving Directions in Harbin | tselmegkh# | Compile Error | / | / | C++20 | 964b | 2024-12-17 14:29:58 | 2024-12-17 14:29:58 |
Judging History
answer
#include<iostream>
using namespace std;
using ll = long long;
char get(char a, char b) {
if(a == 'S' && b == 'E')return 'L';
if(a == 'N' && b == 'W')return 'L';
if(a == 'E' && b == 'N')return 'L';
if(a == 'W' && b == 'S')return 'L';
if(a == 'E' && b == 'S')return 'R';
if(a == 'W' && b == 'N')return 'R';
if(a == 'S' && b == 'W')return 'R';
if(a == 'N' && b == 'E')return 'R';
}
void solve() {
int n;
cin >> n;
vector<pair<char, int>> a(n);
for(int i = 0; i < n; i++){
cin >> a[i].first >> a[i].second;
}
cout << n * 2 - 1 << ' ' << a[0].first << '\n';
cout << "Z " << a[0].second << '\n';
char lst = a[0].first;
for(int i = 1; i < n; i++){
char dir = get(lst, a[i].first);
cout << dir << '\n';
cout << "Z " << a[i].second <<'\n';
}
}
int main() {
int t = 1;
cin >> t;
while(t--){
solve();
}
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:20:5: error: ‘vector’ was not declared in this scope 20 | vector<pair<char, int>> a(n); | ^~~~~~ answer.code:2:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; answer.code:20:26: error: expected primary-expression before ‘>’ token 20 | vector<pair<char, int>> a(n); | ^~ answer.code:20:29: error: ‘a’ was not declared in this scope 20 | vector<pair<char, int>> a(n); | ^ answer.code: In function ‘char get(char, char)’: answer.code:15:1: warning: control reaches end of non-void function [-Wreturn-type] 15 | } | ^