QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#336013 | #6503. DFS Order 3 | ucup-team1087 | Compile Error | / | / | C++17 | 1.2kb | 2024-02-24 11:16:05 | 2024-02-24 11:16:05 |
Judging History
answer
#include <iostream>
using namespace std;
template <class T>
T uread() {
char c = getchar();
while (c < '0' || c > '9') {
c = getchar();
}
T num = 0;
while (c >= '0' && c <= '9') {
num = (num << 1) + (num << 3) + (c ^ 48);
c = getchar();
}
return num;
}
const int N = 1e3 + 1;
vector<int> a[N];
void solve() {
int n = uread<int>();
for (int i = 1; i <= n; ++i) {
a[i].resize(n);
for (int j = 0; j < n; ++j) {
a[i][j] = uread<int>();
}
}
vector<pair<int, int>> ans;
for (int i = 1; i <= n; ++i) {
int v = a[1].back();
ans.push_back({a[v][0], a[v][1]});
if (ans.back().first > ans.back().second) {
swap(ans.back().first, ans.back().second);
}
for (int j = 1; j <= n; ++j) {
a[j].erase(find(a[j].begin(), a[j].end(), v));
}
}
sort(ans.begin(), ans.end());
ans.erase(unique(ans.begin(), ans.end()), ans.end());
for (auto [u, v] : ans) {
printf("%d %d\n", u, v);
}
}
int main(int argc, const char * argv[]) {
int T = uread<int>();
while (T--) {
solve();
}
return 0;
}
Details
answer.code:20:1: error: ‘vector’ does not name a type 20 | vector<int> a[N]; | ^~~~~~ answer.code: In function ‘void solve()’: answer.code:25:9: error: ‘a’ was not declared in this scope 25 | a[i].resize(n); | ^ answer.code:31:5: error: ‘vector’ was not declared in this scope 31 | vector<pair<int, int>> ans; | ^~~~~~ 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:31:25: error: expected primary-expression before ‘>’ token 31 | vector<pair<int, int>> ans; | ^~ answer.code:31:28: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 31 | vector<pair<int, int>> ans; | ^~~ | abs answer.code:33:17: error: ‘a’ was not declared in this scope 33 | int v = a[1].back(); | ^ answer.code:42:5: error: ‘sort’ was not declared in this scope; did you mean ‘short’? 42 | sort(ans.begin(), ans.end()); | ^~~~ | short answer.code:43:15: error: ‘unique’ was not declared in this scope 43 | ans.erase(unique(ans.begin(), ans.end()), ans.end()); | ^~~~~~