#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define F first
#define S second
using namespace std;
typedef long long ll;
const int N = 2e5 + 11;
const int mod = 1e9 + 7;
const ll inf = 1e12 + 11;
ll n;
ll was[N];
pair < pair < ll, ll >, ll > a[N];
vector < pair < ll, ll > > v[4];
map < pair < pair < ll, ll >, ll >, bool > del;
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n;
for(ll i = 1; i <= n; i++){
char d;
ll x, y, tp;
cin >> x >> y >> d;
if(d == 'E') tp = 0;
if(d == 'S') tp = 1;
if(d == 'W') tp = 2;
if(d == 'N') tp = 3;
a[i] = {{x, y}, tp};
v[tp].push_back({x, y});
}
for(ll t = 0; t <= 200; t++){
for(ll i = 1; i <= n; i++){
if(a[i].S == 0) a[i].F.F++;
if(a[i].S == 1) a[i].F.S++;
if(a[i].S == 2) a[i].F.F--;
if(a[i].S == 3) a[i].F.S--;
}
for(ll i = 1; i <= n; i++){
if(was[i]) continue;
vector < ll > id;
for(ll j = 1; j <= n; j++)
if(!was[j] && j != i && a[i].F == a[j].F)
id.push_back(j);
if(!id.empty()){
for(auto j : id) was[j] = 1;
was[i] = 1;
}
}
}
for(ll i = 1; i <= n; i++)
if(!was[i])
cout << i << ' ';
}
# | 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... |