#include <bits/stdc++.h>
#define nemeshay ios_base::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
#define int long long
#define sigma signed
#define pb push_back
#define fr first
#define sc second
#define pii pair<int, int>
using namespace std;
const int N = 1e6 + 2, inf = 1e18 + 7;
pair<pii, char> a[N];
int used[N];
sigma main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i].fr.fr >> a[i].fr.sc >> a[i].sc;
int q = N;
while (q--) {
for (int i = 0; i < n; i++) {
if (used[i]) continue;
if (a[i].sc == 'N') a[i].fr.sc--;
else if (a[i].sc == 'S') a[i].fr.sc++;
else if (a[i].sc == 'W') a[i].fr.fr--;
else a[i].fr.fr++;
}
for (int i = 0; i < n; i++) {
if (used[i]) continue;
for (int j = i + 1; j < n; j++) {
if (!used[j] && a[i].fr.fr == a[j].fr.fr && a[i].fr.sc == a[j].fr.sc) {
used[i] = 1, used[j] = 1;
}
}
}
}
for (int i = 0; i < n; i++) if (!used[i]) cout << i + 1 << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |