Submission #1140712

#TimeUsernameProblemLanguageResultExecution timeMemory
1140712adiyerNaval battle (CEOI24_battle)C++20
12 / 100
3092 ms8364 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...